Exemple #1
0
 /**
  * calculate()
  * getItemCount()
  * hasItems()
  * @magentoDataFixture Magento/Catalog/_files/multiple_products.php
  */
 public function testCalculate()
 {
     /** @var \Magento\Catalog\Model\Session $session */
     $session = $this->_objectManager->get('Magento\\Catalog\\Model\\Session');
     try {
         $session->unsCatalogCompareItemsCount();
         $this->assertFalse($this->_helper->hasItems());
         $this->assertEquals(0, $session->getCatalogCompareItemsCount());
         $this->_populateCompareList();
         $this->_helper->calculate();
         $this->assertEquals(2, $session->getCatalogCompareItemsCount());
         $this->assertTrue($this->_helper->hasItems());
         $session->unsCatalogCompareItemsCount();
     } catch (\Exception $e) {
         $session->unsCatalogCompareItemsCount();
         throw $e;
     }
 }
Exemple #2
0
 /**
  * Customer logout bind process
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return $this
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function bindCustomerLogout(\Magento\Framework\Event\Observer $observer = null)
 {
     $this->_getResource()->purgeVisitorByCustomer($this);
     $this->_catalogProductCompare->calculate(true);
     return $this;
 }