Skip to content

Commit fcafe56

Browse files
author
Anna Bukatar
committed
ACP2E-2658: Magento loads the user quote object when persistent cart is enabled and full page cacheable pages are created
1 parent 8ba8059 commit fcafe56

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

app/code/Magento/Persistent/Test/Unit/Observer/EmulateQuoteObserverTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*/
2929
class EmulateQuoteObserverTest extends TestCase
3030
{
31+
public const EVENT_NAME = 'controller_action_predispatch';
32+
public const OBSERVER_INSTANCE = 'Magento\Persistent\Observer\EmulateQuoteObserver';
33+
3134
/**
3235
* @var EmulateQuoteObserver
3336
*/
@@ -272,4 +275,25 @@ public function testExecuteWhenShoppingCartIsPersistentAndQuoteExist()
272275
$this->checkoutSessionMock->expects($this->once())->method('setCustomerData')->with($this->customerMock);
273276
$this->model->execute($this->observerMock);
274277
}
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+
}
275299
}

0 commit comments

Comments
 (0)