File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
app/code/Magento/Sitemap/Test/Unit/Model Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -142,4 +142,36 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail()
142
142
143
143
$ this ->observer ->scheduledGenerateSitemaps ();
144
144
}
145
+
146
+ /**
147
+ * Test if cron scheduled XML sitemap generation will start and stop the store environment emulation
148
+ *
149
+ * @throws \Exception
150
+ */
151
+ public function testCronGenerateSitemapEnvironmentEmulation ()
152
+ {
153
+ $ storeId = 1 ;
154
+
155
+ $ this ->scopeConfigMock ->expects ($ this ->once ())->method ('isSetFlag ' )->willReturn (true );
156
+
157
+ $ this ->collectionFactoryMock ->expects ($ this ->once ())
158
+ ->method ('create ' )
159
+ ->willReturn ($ this ->sitemapCollectionMock );
160
+
161
+ $ this ->sitemapCollectionMock ->expects ($ this ->any ())
162
+ ->method ('getIterator ' )
163
+ ->willReturn (new \ArrayIterator ([$ this ->sitemapMock ]));
164
+
165
+ $ this ->sitemapMock ->expects ($ this ->at (0 ))
166
+ ->method ('getStoreId ' )
167
+ ->willReturn ($ storeId );
168
+
169
+ $ this ->appEmulationMock ->expects ($ this ->once ())
170
+ ->method ('startEnvironmentEmulation ' );
171
+
172
+ $ this ->appEmulationMock ->expects ($ this ->once ())
173
+ ->method ('stopEnvironmentEmulation ' );
174
+
175
+ $ this ->observer ->scheduledGenerateSitemaps ();
176
+ }
145
177
}
You can’t perform that action at this time.
0 commit comments