/** * This is not necessarily a good test, it doesn't generate any proxies * because there are none in the AnnotationsBundle. However that is * rather a task of doctrine to test. We touch the lines here and * verify that the container is called correctly for the relevant information. * * @group DoctrineODMMongoDBProxy */ public function testWarmCache() { $testManager = $this->createTestDocumentManager(array(__DIR__ . "/../DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Document")); $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $registry = new ManagerRegistry('MongodB', array(), array('default' => 'doctrine_mongodb.odm.default_document_manager', 'foo' => 'doctrine_mongodb.odm.foo_document_manager'), 'default', 'default', 'Doctrine\\ODM\\MongoDB\\Proxy\\Proxy'); $registry->setContainer($container); $container->expects($this->at(0))->method('getParameter')->with($this->equalTo('doctrine_mongodb.odm.proxy_dir'))->will($this->returnValue(sys_get_temp_dir())); $container->expects($this->at(1))->method('getParameter')->with($this->equalTo('doctrine_mongodb.odm.auto_generate_proxy_classes'))->will($this->returnValue(false)); $container->expects($this->at(2))->method('get')->with($this->equalTo('doctrine_mongodb'))->will($this->returnValue($registry)); $container->expects($this->at(3))->method('get')->with($this->equalTo('doctrine_mongodb.odm.default_document_manager'))->will($this->returnValue($testManager)); $container->expects($this->at(4))->method('get')->with($this->equalTo('doctrine_mongodb.odm.foo_document_manager'))->will($this->returnValue($testManager)); $cacheWarmer = new ProxyCacheWarmer($container); $cacheWarmer->warmUp(sys_get_temp_dir()); }