Exemplo n.º 1
0
 public function testRepositoriesCanBeRetrieved()
 {
     $loader = Phake::mock('Fabricius\\Loader\\LoaderInterface');
     $cache = Phake::mock('Doctrine\\Common\\Cache\\Cache');
     $library = new Library($this->eventDispatcher, $this->metadataFactory, $this->parser);
     $library->registerRepository('Fabricius\\Tests\\ContentItem', $loader, $cache);
     $repositories = $library->getRepositories();
     $this->assertCount(1, $repositories);
     $this->assertArrayHasKey('Fabricius\\Tests\\ContentItem', $repositories);
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function getRepository($name)
 {
     @(list($bundle, $name) = explode(':', $name));
     if (!$name) {
         return parent::getRepository($bundle);
     }
     $bundle = $this->kernel->getBundle($bundle);
     return parent::getRepository($bundle->getNamespace() . '\\' . $name);
 }