/**
  * @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));
 }
Exemple #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 testCustomerLoginLoggedInTrue()
 {
     $customerId = 222;
     $visitorId = 333;
     $observerMock = $this->getObserverMock(111);
     $this->customerSessionMock->expects($this->once())->method('isLoggedIn')->willReturn(true);
     $this->customerSessionMock->expects($this->once())->method('getCustomerId')->willReturn($customerId);
     $this->customerVisitorMock->expects($this->once())->method('getId')->willReturn($visitorId);
     $this->reportEventMock->expects($this->once())->method('updateCustomerType')->with($visitorId, $customerId);
     $this->productCompModelMock->expects($this->once())->method('updateCustomerFromVisitor')->willReturnSelf();
     $this->productCompModelMock->expects($this->once())->method('calculate')->willReturnSelf();
     $this->productIndexMock->expects($this->once())->method('updateCustomerFromVisitor')->willReturnSelf();
     $this->productIndexMock->expects($this->once())->method('calculate')->willReturnSelf();
     $this->observer->execute($observerMock);
 }
 /**
  * @param array $expectedEventData
  * @return void
  */
 protected function prepareReportEventModel($expectedEventData)
 {
     $this->reportEventMock->expects($this->any())->method('setData')->with($expectedEventData)->willReturnSelf();
     $this->reportEventMock->expects($this->any())->method('save')->willReturnSelf();
 }