File tree Expand file tree Collapse file tree 3 files changed +39
-4
lines changed
DependencyInjection/CompilerPass Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,9 @@ public function process(ContainerBuilder $container)
3838 }
3939
4040 // Нет в контейнере параметра warming_pages - прогрев только главной страницы.
41- if (! $ container ->hasParameter ('warming_pages ' )) {
41+ if ($ container ->hasParameter ('warming_pages ' )) {
4242 $ definition = $ container ->getDefinition ('bitrix_ordinary_tools.bitrix_page_cache_warmer ' );
43- $ definition ->replaceArgument (2 , [ ' / ' ] );
43+ $ definition ->replaceArgument (2 , $ container -> getParameter ( ' warming_pages ' ) );
4444 }
4545 }
4646}
Original file line number Diff line number Diff line change @@ -23,6 +23,6 @@ services:
2323 arguments :
2424 - ' @http_client'
2525 - ' %kernel.site.host%'
26- - ['%warming_pages% ']
26+ - ['/ ']
2727 class : Prokl\BitrixOrdinaryToolsBundle\Services\CacheWarmer\BitrixCacheWarmer
2828 tags : [kernel.cache_warmer]
Original file line number Diff line number Diff line change @@ -87,7 +87,42 @@ public function testNoPageParameters() : void
8787 $ newDefinition = $ this ->container ->getDefinition ('bitrix_ordinary_tools.bitrix_page_cache_warmer ' );
8888 $ newParam = $ newDefinition ->getArguments ();
8989
90- $ this ->assertSame (['/ ' ], $ newParam [2 ]);
90+ $ this ->assertSame (['/xxx/ ' ], $ newParam [2 ]);
91+ }
92+
93+ /**
94+ * Задан параметр warming_pages.
95+ *
96+ * @return void
97+ */
98+ public function testHasPageParameters () : void
99+ {
100+ $ this ->container ->setDefinition (
101+ 'http_client ' ,
102+ new Definition (get_class ($ this ->fakeService ))
103+ );
104+
105+ $ this ->container ->setParameter (
106+ 'warming_pages ' ,
107+ ['/page/ ' ]
108+ );
109+
110+ $ definition = new Definition (get_class ($ this ->fakeService ));
111+ $ definition ->addArgument ($ this ->container ->getDefinition ('http_client ' ));
112+ $ definition ->addArgument ('localhost ' );
113+ $ definition ->addArgument (['/xxx/ ' ]);
114+
115+ $ this ->container ->setDefinition (
116+ 'bitrix_ordinary_tools.bitrix_page_cache_warmer ' ,
117+ $ definition
118+ );
119+
120+ $ this ->obTestObject ->process ($ this ->container );
121+
122+ $ newDefinition = $ this ->container ->getDefinition ('bitrix_ordinary_tools.bitrix_page_cache_warmer ' );
123+ $ newParam = $ newDefinition ->getArguments ();
124+
125+ $ this ->assertSame (['/page/ ' ], $ newParam [2 ]);
91126 }
92127
93128 /**
You can’t perform that action at this time.
0 commit comments