コード例 #1
0
ファイル: MapperTest.php プロジェクト: taichiatshanghai/yamop
 public function testFindSetsCursor()
 {
     $mapper = new Mapper('\\Model\\Simple');
     $emptyCursor = $mapper->getCursor();
     $this->assertSame(null, $emptyCursor);
     $mapper->find(array('not_existing' => 'nothing'));
     $cursor = $mapper->getCursor();
     $this->assertTrue(\Model\Simple::$isCollectionNameCalled);
     $this->assertInstanceOf('\\MongoCursor', $cursor);
     $this->assertEquals(0, $cursor->count());
     $data = $this->_saveSimpleData();
     $result = $mapper->find($data);
     $cursor = $mapper->getCursor();
     $this->assertInstanceOf('\\MongoCursor', $cursor);
     $this->assertEquals(1, $cursor->count());
 }