/**
  * After generate Xml
  *
  * @param \Magento\Framework\View\LayoutInterface $subject
  * @param \Magento\Framework\View\LayoutInterface $result
  * @return \Magento\Framework\View\LayoutInterface
  */
 public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, \Magento\Framework\View\LayoutInterface $result)
 {
     if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
         $this->persistentSession->setCustomerId(null);
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testLoadByCookieKey()
 {
     /** @var \Magento\Persistent\Model\Session $preSession */
     $preSession = $this->objectManager->get('Magento\\Persistent\\Model\\SessionFactory')->create()->loadByCookieKey();
     $this->assertNull($preSession->getCustomerId());
     $this->session->setCustomerId(1)->save();
     $this->session->setPersistentCookie(1000, '/');
     /** @var \Magento\Persistent\Model\Session $postSession */
     $postSession = $this->objectManager->get('Magento\\Persistent\\Model\\SessionFactory')->create()->loadByCookieKey();
     $this->assertEquals(1, $postSession->getCustomerId());
 }