File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/Symfony/Bundle/FrameworkBundle
DependencyInjection/Compiler
Tests/DependencyInjection/Compiler Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ public function process(ContainerBuilder $container)
3737 $ warmers [$ priority ][] = new Reference ($ id );
3838 }
3939
40+ if (empty ($ warmers )) {
41+ return ;
42+ }
43+
4044 // sort by priority and flatten
4145 krsort ($ warmers );
4246 $ warmers = call_user_func_array ('array_merge ' , $ warmers );
Original file line number Diff line number Diff line change @@ -69,4 +69,24 @@ public function testThatCompilerPassIsIgnoredIfThereIsNoCacheWarmerDefinition()
6969 $ addCacheWarmerPass = new AddCacheWarmerPass ();
7070 $ addCacheWarmerPass ->process ($ container );
7171 }
72+
73+ public function testThatCacheWarmersMightBeNotDefined ()
74+ {
75+ $ definition = $ this ->getMock ('Symfony\Component\DependencyInjection\Definition ' );
76+ $ container = $ this ->getMock ('Symfony\Component\DependencyInjection\ContainerBuilder ' );
77+
78+ $ container ->expects ($ this ->atLeastOnce ())
79+ ->method ('findTaggedServiceIds ' )
80+ ->will ($ this ->returnValue (array ()));
81+ $ container ->expects ($ this ->never ())->method ('getDefinition ' );
82+ $ container ->expects ($ this ->atLeastOnce ())
83+ ->method ('hasDefinition ' )
84+ ->with ('cache_warmer ' )
85+ ->will ($ this ->returnValue (true ));
86+
87+ $ definition ->expects ($ this ->never ())->method ('replaceArgument ' );
88+
89+ $ addCacheWarmerPass = new AddCacheWarmerPass ();
90+ $ addCacheWarmerPass ->process ($ container );
91+ }
7292}
You can’t perform that action at this time.
0 commit comments