@@ -28,20 +28,25 @@ public function testWarmCache()
28
28
$ testManager = $ this ->createTestEntityManager (array (
29
29
__DIR__ . "/../DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity " )
30
30
);
31
+
31
32
$ container = $ this ->getMock ('Symfony\Component\DependencyInjection\Container ' );
32
33
$ container ->expects ($ this ->at (0 ))
33
34
->method ('getParameter ' )
34
35
->with ($ this ->equalTo ('doctrine.orm.proxy_dir ' ))
35
36
->will ($ this ->returnValue (sys_get_temp_dir ()));
36
37
$ container ->expects ($ this ->at (1 ))
38
+ ->method ('getParameter ' )
39
+ ->with ($ this ->equalTo ('doctrine.orm.auto_generate_proxy_classes ' ))
40
+ ->will ($ this ->returnValue ( false ));
41
+ $ container ->expects ($ this ->at (2 ))
37
42
->method ('getParameter ' )
38
43
->with ($ this ->equalTo ('doctrine.orm.entity_managers ' ))
39
44
->will ($ this ->returnValue (array ('default ' , 'foo ' )));
40
- $ container ->expects ($ this ->at (2 ))
45
+ $ container ->expects ($ this ->at (3 ))
41
46
->method ('get ' )
42
47
->with ($ this ->equalTo ('doctrine.orm.default_entity_manager ' ))
43
48
->will ($ this ->returnValue ($ testManager ));
44
- $ container ->expects ($ this ->at (3 ))
49
+ $ container ->expects ($ this ->at (4 ))
45
50
->method ('get ' )
46
51
->with ($ this ->equalTo ('doctrine.orm.foo_entity_manager ' ))
47
52
->will ($ this ->returnValue ($ testManager ));
@@ -50,6 +55,32 @@ public function testWarmCache()
50
55
$ cacheWarmer ->warmUp (sys_get_temp_dir ());
51
56
}
52
57
58
+ public function testSkipWhenProxiesAreAutoGenerated ()
59
+ {
60
+ $ testManager = $ this ->createTestEntityManager (array (
61
+ __DIR__ . "/../DependencyInjection/Fixtures/Bundles/AnnotationsBundle/Entity " )
62
+ );
63
+
64
+ $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\Container ' );
65
+ $ container ->expects ($ this ->at (0 ))
66
+ ->method ('getParameter ' )
67
+ ->with ($ this ->equalTo ('doctrine.orm.proxy_dir ' ))
68
+ ->will ($ this ->returnValue (sys_get_temp_dir ()));
69
+ $ container ->expects ($ this ->at (1 ))
70
+ ->method ('getParameter ' )
71
+ ->with ($ this ->equalTo ('doctrine.orm.auto_generate_proxy_classes ' ))
72
+ ->will ($ this ->returnValue ( true ));
73
+ $ container ->expects ($ this ->at (2 ))
74
+ ->method ('getParameter ' )
75
+ ->with ($ this ->equalTo ('assertion ' ))
76
+ ->will ($ this ->returnValue ( true ));
77
+
78
+ $ cacheWarmer = new ProxyCacheWarmer ($ container );
79
+ $ cacheWarmer ->warmUp (sys_get_temp_dir ());
80
+
81
+ $ container ->getParameter ('assertion ' ); // check that the assertion is really the third call.
82
+ }
83
+
53
84
public function testProxyCacheWarmingIsNotOptional ()
54
85
{
55
86
$ container = $ this ->getMock ('Symfony\Component\DependencyInjection\Container ' );
0 commit comments