Exemple #1
0
 public function testCollection()
 {
     $mongator = new Mongator($this->metadataFactory, $this->cache);
     $connection = new Connection($this->server, $this->dbName . '_collection');
     $mongator->setConnection('default', $connection);
     $mongator->setDefaultConnectionName('default');
     $collection = $mongator->getRepository('Model\\Article')->getCollection();
     $this->assertEquals($connection->getMongoDB()->selectCollection('articles'), $collection);
     $this->assertSame($collection, $mongator->getRepository('Model\\Article')->getCollection());
 }
Exemple #2
0
 public function testGetRepository()
 {
     $mongator = new Mongator($this->metadataFactory);
     $articleRepository = $mongator->getRepository('Model\\Article');
     $this->assertInstanceOf('Model\\ArticleRepository', $articleRepository);
     $this->assertSame($mongator, $articleRepository->getMongator());
     $this->assertSame($articleRepository, $mongator->getRepository('Model\\Article'));
     $categoryRepository = $mongator->getRepository('Model\\Category');
     $this->assertInstanceOf('Model\\CategoryRepository', $categoryRepository);
 }