|
21 | 21 | use PHPUnit\Framework\TestCase;
|
22 | 22 | use Psr\Log\LoggerInterface;
|
23 | 23 | use Magento\Framework\Session\StorageInterface;
|
| 24 | +use Magento\Framework\App\Request\Http as RequestHttp; |
24 | 25 |
|
25 | 26 | /**
|
26 | 27 | * Unit test for CustomerNotification plugin
|
@@ -83,8 +84,7 @@ protected function setUp(): void
|
83 | 84 |
|
84 | 85 | $this->customerRepositoryMock = $this->getMockForAbstractClass(CustomerRepositoryInterface::class);
|
85 | 86 | $this->actionMock = $this->getMockForAbstractClass(ActionInterface::class);
|
86 |
| - $this->requestMock = $this->getMockBuilder(RequestStubInterface::class) |
87 |
| - ->getMockForAbstractClass(); |
| 87 | + $this->requestMock = $this->createMock(RequestHttp::class); |
88 | 88 | $this->requestMock->method('isPost')->willReturn(true);
|
89 | 89 |
|
90 | 90 | $this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);
|
@@ -153,4 +153,17 @@ public function testBeforeDispatchWithNoCustomerFound()
|
153 | 153 |
|
154 | 154 | $this->plugin->beforeExecute($this->actionMock);
|
155 | 155 | }
|
| 156 | + |
| 157 | + public function testBeforeExecuteForLogoutRequest() |
| 158 | + { |
| 159 | + $this->requestMock->method('getRouteName')->willReturn('customer'); |
| 160 | + $this->requestMock->method('getControllerName')->willReturn('account'); |
| 161 | + $this->requestMock->method('getActionName')->willReturn('logout'); |
| 162 | + |
| 163 | + $this->sessionMock->expects($this->never())->method('regenerateId'); |
| 164 | + $this->sessionMock->expects($this->never())->method('setCustomerData'); |
| 165 | + $this->sessionMock->expects($this->never())->method('setCustomerGroupId'); |
| 166 | + |
| 167 | + $this->plugin->beforeExecute($this->actionMock); |
| 168 | + } |
156 | 169 | }
|
0 commit comments