/** * @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)); }
/** * @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); }
/** * @param bool $isLoggedIn * @param string $userKey * @param int $userId * @dataProvider catalogProductCompareAddProductDataProvider * @return void */ public function testCatalogProductCompareAddProduct($isLoggedIn, $userKey, $userId) { $productId = 111; $customerId = 222; $visitorId = 333; $viewData = ['product_id' => $productId, $userKey => $userId]; $observerMock = $this->getObserverMock($productId); $this->customerSessionMock->expects($this->any())->method('isLoggedIn')->willReturn($isLoggedIn); $this->customerSessionMock->expects($this->any())->method('getCustomerId')->willReturn($customerId); $this->customerVisitorMock->expects($this->any())->method('getId')->willReturn($visitorId); $this->productCompModelMock->expects($this->any())->method('setData')->with($viewData)->willReturnSelf(); $this->productCompModelMock->expects($this->any())->method('save')->willReturnSelf(); $this->productCompModelMock->expects($this->any())->method('calculate')->willReturnSelf(); $this->eventSaverMock->expects($this->once())->method('save'); $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); }