20 private $cookieManager;
25 private $metadataFactory;
35 private $sessionManager;
39 $this->cookieManager = $this->getMockBuilder(\
Magento\Framework\Stdlib\Cookie\PhpCookieManager::class)
40 ->disableOriginalConstructor()
42 $this->metadataFactory = $this->getMockBuilder(\
Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class)
43 ->disableOriginalConstructor()
45 $this->metadata = $this->getMockBuilder(\
Magento\Framework\Stdlib\Cookie\CookieMetadata::class)
46 ->disableOriginalConstructor()
48 $this->sessionManager = $this->getMockBuilder(\
Magento\Framework\Session\SessionManager::class)
49 ->disableOriginalConstructor()
63 $observerMock = $this->createMock(\
Magento\Framework\Event\Observer::class);
64 $frontendSessionCookieName =
'mage-cache-sessid';
65 $this->cookieManager->expects($this->once())
67 ->with($frontendSessionCookieName)
70 $this->metadataFactory->expects($this->{$callCount}())
71 ->method(
'createCookieMetadata')
72 ->willReturn($this->metadata);
73 $this->metadata->expects($this->{$callCount}())
76 $this->cookieManager->expects($this->{$callCount}())
77 ->method(
'deleteCookie')
78 ->with(
'mage-cache-sessid', $this->metadata);
80 $this->observer->execute($observerMock);
beforeStartDataProvider()
testBeforeStart($result, $callCount)