File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
app/code/Magento/Persistent/Test/Unit/Observer Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 28
28
*/
29
29
class EmulateQuoteObserverTest extends TestCase
30
30
{
31
+ public const EVENT_NAME = 'controller_action_predispatch ' ;
32
+ public const OBSERVER_INSTANCE = 'Magento\Persistent\Observer\EmulateQuoteObserver ' ;
33
+
31
34
/**
32
35
* @var EmulateQuoteObserver
33
36
*/
@@ -272,4 +275,25 @@ public function testExecuteWhenShoppingCartIsPersistentAndQuoteExist()
272
275
$ this ->checkoutSessionMock ->expects ($ this ->once ())->method ('setCustomerData ' )->with ($ this ->customerMock );
273
276
$ this ->model ->execute ($ this ->observerMock );
274
277
}
278
+
279
+ /**
280
+ * Test observer is disabled as it may cause performance degradation for quotes with lots of sales rules
281
+ *
282
+ * @return void
283
+ */
284
+ public function testDisabled ()
285
+ {
286
+ $ eventsXml = simplexml_load_file (__DIR__ . '/../../../etc/frontend/events.xml ' );
287
+ $ status = 'false ' ;
288
+ foreach ($ eventsXml ->event as $ event ) {
289
+ if ($ event ->attributes ()['name ' ] == self ::EVENT_NAME ) {
290
+ foreach ($ event ->observer as $ observer ) {
291
+ if ((string )$ observer ->attributes ()['instance ' ] == self ::OBSERVER_INSTANCE ) {
292
+ $ status = $ observer ->attributes ()['disabled ' ];
293
+ }
294
+ }
295
+ }
296
+ }
297
+ $ this ->assertTrue ($ status == 'true ' );
298
+ }
275
299
}
You can’t perform that action at this time.
0 commit comments