Esempio n. 1
0
 public function testDelete()
 {
     $cookiePath = '/';
     $cookieDomain = 'example.com';
     /** @var PublicCookieMetadata|\PHPUnit_Framework_MockObject_MockObject $metadata */
     $metadata = $this->getMockBuilder('Magento\\Framework\\Stdlib\\Cookie\\PublicCookieMetadata')->disableOriginalConstructor()->getMock();
     $this->cookieMetadataFactory->expects(static::once())->method('createCookieMetadata')->willReturn($metadata);
     $this->sessionManager->expects(static::once())->method('getCookiePath')->willReturn($cookiePath);
     $metadata->expects(static::once())->method('setPath')->with($cookiePath)->willReturnSelf();
     $this->sessionManager->expects(static::once())->method('getCookieDomain')->willReturn($cookieDomain);
     $metadata->expects(static::once())->method('setDomain')->with($cookieDomain)->willReturnSelf();
     $this->cookieManagerMock->expects(static::once())->method('deleteCookie')->with(FormKey::COOKIE_NAME, $metadata);
     $this->formKey->delete();
 }
 /**
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $this->cookieFormKey->delete();
 }