Exemplo n.º 1
0
 public function tearDown()
 {
     MockPost::$connection = null;
     MockTag::$connection = null;
     MockComment::$connection = null;
     MockCreator::$connection = null;
     MockPost::reset();
     MockTag::reset();
     MockComment::reset();
     MockPostForValidates::reset();
     MockCreator::reset();
 }
Exemplo n.º 2
0
 public function testMultiRecordDelete()
 {
     $result = MockPost::remove(array('published' => false));
     $query = $result['query'];
     $this->assertEqual('delete', $query->type());
     $this->assertEqual(array('published' => false), $query->conditions());
     $keys = array_keys(array_filter($query->export(MockPost::connection())));
     $this->assertEqual(array('conditions', 'model', 'type', 'source', 'alias'), $keys);
 }
Exemplo n.º 3
0
	public function testSettingNestedObjectDefaults() {
		$this->skipIf(!MockMongoConnection::enabled(), 'MongoDb not enabled.');

		MockPost::$connection = new MockMongoConnection();
		$schema = MockPost::schema();

		MockPost::overrideSchema($schema + array('nested.value' => array(
			'type' => 'string',
			'default' => 'foo'
		)));
		$this->assertEqual('foo', MockPost::create()->nested->value);

		$data = array('nested' => array('value' => 'bar'));
		$this->assertEqual('bar', MockPost::create($data)->nested->value);

		MockPost::overrideSchema($schema);
		MockPost::$connection = null;
	}