54 $this->requestMock = $this->createMock(\
Magento\Framework\
App\Request\Http::class);
55 $this->helperMock = $this->createMock(\
Magento\Persistent\Helper\Data::class);
56 $this->sessionHelperMock = $this->createMock(\
Magento\Persistent\Helper\Session::class);
57 $this->customerSessionMock = $this->createMock(\
Magento\Customer\Model\Session::class);
58 $this->observerMock = $this->createMock(\
Magento\Framework\Event\Observer::class);
59 $eventMethods = [
'getRequest',
'__wakeUp'];
60 $this->eventManagerMock = $this->createPartialMock(\
Magento\Framework\Event::class, $eventMethods);
61 $this->sessionMock = $this->createMock(\
Magento\Persistent\Model\Session::class);
62 $this->model = new \Magento\Persistent\Observer\SynchronizePersistentInfoObserver(
64 $this->sessionHelperMock,
65 $this->customerSessionMock
71 $this->helperMock->expects($this->once())->method(
'isEnabled')->will($this->returnValue(
false));
72 $this->sessionHelperMock->expects($this->never())->method(
'getSession');
73 $this->model->execute($this->observerMock);
78 $this->helperMock->expects($this->once())->method(
'isEnabled')->will($this->returnValue(
true));
79 $this->sessionHelperMock->expects($this->once())->method(
'isPersistent')->will($this->returnValue(
true));
80 $this->sessionHelperMock
81 ->expects($this->once())
82 ->method(
'getSession')
83 ->will($this->returnValue($this->sessionMock));
85 ->expects($this->once())
87 ->will($this->returnValue($this->eventManagerMock));
88 $this->eventManagerMock
89 ->expects($this->once())
90 ->method(
'getRequest')
91 ->will($this->returnValue($this->requestMock));
92 $this->customerSessionMock->expects($this->once())->method(
'isLoggedIn')->will($this->returnValue(
false));
94 ->expects($this->once())
95 ->method(
'getFullActionName')
96 ->will($this->returnValue(
'customer_account_logout'));
97 $this->sessionMock->expects($this->once())->method(
'save');
98 $this->model->execute($this->observerMock);
testSynchronizePersistentInfoWhenPersistentDataIsEnabled()
testSynchronizePersistentInfoWhenPersistentDataNotEnabled()