44 $this->helperMock = $this->createMock(\
Magento\Persistent\Helper\Data::class);
45 $this->sessionHelperMock = $this->createMock(\
Magento\Persistent\Helper\Session::class);
46 $this->checkoutSessionMock = $this->createMock(\
Magento\Checkout\Model\Session::class);
47 $this->customerSessionMock = $this->createMock(\
Magento\Customer\Model\Session::class);
48 $this->observerMock = $this->createMock(\
Magento\Framework\Event\Observer::class);
50 $this->model = new \Magento\Persistent\Observer\SetLoadPersistentQuoteObserver(
51 $this->sessionHelperMock,
53 $this->customerSessionMock,
54 $this->checkoutSessionMock
60 $this->sessionHelperMock->expects($this->once())->method(
'isPersistent')->will($this->returnValue(
false));
61 $this->checkoutSessionMock->expects($this->never())->method(
'setLoadInactive');
62 $this->model->execute($this->observerMock);
67 $this->sessionHelperMock->expects($this->once())->method(
'isPersistent')->will($this->returnValue(
true));
68 $this->customerSessionMock->expects($this->once())->method(
'isLoggedIn')->will($this->returnValue(
false));
69 $this->helperMock->expects($this->once())->method(
'isShoppingCartPersist')->will($this->returnValue(
true));
70 $this->checkoutSessionMock->expects($this->never())->method(
'setLoadInactive');
71 $this->model->execute($this->observerMock);
testExecuteWhenSessionIsNotPersistent()