|
@@ -28,20 +28,25 @@ class ProxyCacheWarmerTest extends \Symfony\Bundle\DoctrineBundle\Tests\TestCase
|
|
|
$testManager = $this->createTestEntityManager(array(
|
|
|
__DIR__ . "/../DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity")
|
|
|
);
|
|
|
+
|
|
|
$container = $this->getMock('Symfony\Component\DependencyInjection\Container');
|
|
|
$container->expects($this->at(0))
|
|
|
->method('getParameter')
|
|
|
->with($this->equalTo('doctrine.orm.proxy_dir'))
|
|
|
->will($this->returnValue(sys_get_temp_dir()));
|
|
|
$container->expects($this->at(1))
|
|
|
+ ->method('getParameter')
|
|
|
+ ->with($this->equalTo('doctrine.orm.auto_generate_proxy_classes'))
|
|
|
+ ->will($this->returnValue( false ));
|
|
|
+ $container->expects($this->at(2))
|
|
|
->method('getParameter')
|
|
|
->with($this->equalTo('doctrine.orm.entity_managers'))
|
|
|
->will($this->returnValue(array('default', 'foo')));
|
|
|
- $container->expects($this->at(2))
|
|
|
+ $container->expects($this->at(3))
|
|
|
->method('get')
|
|
|
->with($this->equalTo('doctrine.orm.default_entity_manager'))
|
|
|
->will($this->returnValue($testManager));
|
|
|
- $container->expects($this->at(3))
|
|
|
+ $container->expects($this->at(4))
|
|
|
->method('get')
|
|
|
->with($this->equalTo('doctrine.orm.foo_entity_manager'))
|
|
|
->will($this->returnValue($testManager));
|
|
@@ -50,6 +55,32 @@ class ProxyCacheWarmerTest extends \Symfony\Bundle\DoctrineBundle\Tests\TestCase
|
|
|
$cacheWarmer->warmUp(sys_get_temp_dir());
|
|
|
}
|
|
|
|
|
|
+ public function testSkipWhenProxiesAreAutoGenerated()
|
|
|
+ {
|
|
|
+ $testManager = $this->createTestEntityManager(array(
|
|
|
+ __DIR__ . "/../DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity")
|
|
|
+ );
|
|
|
+
|
|
|
+ $container = $this->getMock('Symfony\Component\DependencyInjection\Container');
|
|
|
+ $container->expects($this->at(0))
|
|
|
+ ->method('getParameter')
|
|
|
+ ->with($this->equalTo('doctrine.orm.proxy_dir'))
|
|
|
+ ->will($this->returnValue(sys_get_temp_dir()));
|
|
|
+ $container->expects($this->at(1))
|
|
|
+ ->method('getParameter')
|
|
|
+ ->with($this->equalTo('doctrine.orm.auto_generate_proxy_classes'))
|
|
|
+ ->will($this->returnValue( true ));
|
|
|
+ $container->expects($this->at(2))
|
|
|
+ ->method('getParameter')
|
|
|
+ ->with($this->equalTo('assertion'))
|
|
|
+ ->will($this->returnValue( true ));
|
|
|
+
|
|
|
+ $cacheWarmer = new ProxyCacheWarmer($container);
|
|
|
+ $cacheWarmer->warmUp(sys_get_temp_dir());
|
|
|
+
|
|
|
+ $container->getParameter('assertion'); // check that the assertion is really the third call.
|
|
|
+ }
|
|
|
+
|
|
|
public function testProxyCacheWarmingIsNotOptional()
|
|
|
{
|
|
|
$container = $this->getMock('Symfony\Component\DependencyInjection\Container');
|