39 $this->customerSessionMock = $this->createMock(\
Magento\Customer\Model\Session::class);
40 $this->observerMock = $this->createMock(\
Magento\Framework\Event\Observer::class);
41 $this->quoteManagerMock = $this->createMock(\
Magento\Persistent\Model\QuoteManager::class);
42 $this->requestMock = $this->createMock(\
Magento\Framework\
App\RequestInterface::class);
43 $this->model = new \Magento\Persistent\Observer\CustomerAuthenticatedEventObserver(
44 $this->customerSessionMock,
46 $this->quoteManagerMock
52 $this->customerSessionMock
53 ->expects($this->once())
54 ->method(
'setCustomerId')
56 ->will($this->returnSelf());
57 $this->customerSessionMock
58 ->expects($this->once())
59 ->method(
'setCustomerGroupId')
61 ->will($this->returnSelf());
63 ->expects($this->once())
66 ->will($this->returnValue(
'not_checkout'));
67 $this->quoteManagerMock->expects($this->once())->method(
'expire');
68 $this->quoteManagerMock->expects($this->never())->method(
'setGuest');
69 $this->model->execute($this->observerMock);
74 $this->customerSessionMock
75 ->expects($this->once())
76 ->method(
'setCustomerId')
78 ->will($this->returnSelf());
79 $this->customerSessionMock
80 ->expects($this->once())
81 ->method(
'setCustomerGroupId')
83 ->will($this->returnSelf());
85 ->expects($this->once())
88 ->will($this->returnValue(
'checkout'));
89 $this->quoteManagerMock->expects($this->never())->method(
'expire');
90 $this->quoteManagerMock->expects($this->once())->method(
'setGuest');
91 $this->model->execute($this->observerMock);
testExecuteDuringCheckout()