예제 #1
0
 /**
  * @return void
  */
 public function testAfterClean()
 {
     $this->eventMock->expects($this->once())->method('clean');
     $this->comparedMock->expects($this->once())->method('clean');
     $this->viewedMock->expects($this->once())->method('clean');
     $this->assertEquals($this->logResourceMock, $this->log->afterClean($this->subjectMock, $this->logResourceMock));
 }
예제 #2
0
 /**
  * Clean events by old visitors after plugin for clean method
  *
  * @param \Magento\Customer\Model\ResourceModel\Visitor $subject
  * @param \Magento\Customer\Model\ResourceModel\Visitor $logResourceModel
  *
  * @return \Magento\Customer\Model\ResourceModel\Visitor
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * @see Global Log Clean Settings
  */
 public function afterClean(\Magento\Customer\Model\ResourceModel\Visitor $subject, $logResourceModel)
 {
     $this->_reportEvent->clean();
     $this->_comparedProductIdx->clean();
     $this->_viewedProductIdx->clean();
     return $logResourceModel;
 }
 /**
  * @return void
  */
 public function testCustomerLogout()
 {
     $observerMock = $this->getObserverMock(111);
     $this->productCompModelMock->expects($this->once())->method('purgeVisitorByCustomer')->willReturnSelf();
     $this->productCompModelMock->expects($this->once())->method('calculate')->willReturnSelf();
     $this->productIndexMock->expects($this->once())->method('purgeVisitorByCustomer')->willReturnSelf();
     $this->productIndexMock->expects($this->once())->method('calculate')->willReturnSelf();
     $this->observer->execute($observerMock);
 }
 /**
  * @return void
  */
 public function testCustomerLoginLoggedInFalse()
 {
     $observerMock = $this->getObserverMock(111);
     $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->willReturn(false);
     $this->customerSessionMock->expects($this->never())->method('getCustomerId');
     $this->customerVisitorMock->expects($this->never())->method('getId');
     $this->productCompModelMock->expects($this->never())->method('updateCustomerFromVisitor')->willReturnSelf();
     $this->productCompModelMock->expects($this->never())->method('calculate')->willReturnSelf();
     $this->productIndexMock->expects($this->never())->method('updateCustomerFromVisitor')->willReturnSelf();
     $this->productIndexMock->expects($this->never())->method('calculate')->willReturnSelf();
     $this->observer->execute($observerMock);
 }
 /**
  * @param array $expectedViewedData
  * @return void
  */
 protected function prepareProductIndexMock($expectedViewedData)
 {
     $this->productIndexMock->expects($this->any())->method('setData')->with($expectedViewedData)->willReturnSelf();
     $this->productIndexMock->expects($this->any())->method('save')->willReturnSelf();
     $this->productIndexMock->expects($this->any())->method('calculate')->willReturnSelf();
 }