예제 #1
0
 public function testEntitiesNoConnectionException()
 {
     $db = new MockMongoConnection($this->_testConfig + array('autoConnect' => false));
     $this->expectException('Could not connect to the database.');
     $result = $db->entities(null);
 }
예제 #2
0
파일: ModelTest.php 프로젝트: niel/lithium
	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;
	}