File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ public function beforeExecute(ActionInterface $subject)
110
110
111
111
if (!$ this ->isFrontendRequest ()
112
112
|| !$ this ->isPostRequest ()
113
+ || $ this ->isLogoutRequest ()
113
114
|| !$ this ->isSessionUpdateRegisteredFor ($ customerId )) {
114
115
return ;
115
116
}
@@ -146,6 +147,11 @@ private function isPostRequest(): bool
146
147
return $ this ->request instanceof HttpRequestInterface && $ this ->request ->isPost ();
147
148
}
148
149
150
+ private function isLogoutRequest (): bool
151
+ {
152
+ return $ this ->request ->getRequestUri () === '/customer/account/logout/ ' ;
153
+ }
154
+
149
155
/**
150
156
* Check if the current application area is frontend.
151
157
*
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ protected function setUp(): void
84
84
$ this ->customerRepositoryMock = $ this ->getMockForAbstractClass (CustomerRepositoryInterface::class);
85
85
$ this ->actionMock = $ this ->getMockForAbstractClass (ActionInterface::class);
86
86
$ this ->requestMock = $ this ->getMockBuilder (RequestStubInterface::class)
87
+ ->addMethods (['getRequestUri ' ])
87
88
->getMockForAbstractClass ();
88
89
$ this ->requestMock ->method ('isPost ' )->willReturn (true );
89
90
@@ -153,4 +154,15 @@ public function testBeforeDispatchWithNoCustomerFound()
153
154
154
155
$ this ->plugin ->beforeExecute ($ this ->actionMock );
155
156
}
157
+
158
+ public function testBeforeExecuteForLogoutRequest ()
159
+ {
160
+ $ this ->requestMock ->method ('getRequestUri ' )->willReturn ('/customer/account/logout/ ' );
161
+
162
+ $ this ->sessionMock ->expects ($ this ->never ())->method ('regenerateId ' );
163
+ $ this ->sessionMock ->expects ($ this ->never ())->method ('setCustomerData ' );
164
+ $ this ->sessionMock ->expects ($ this ->never ())->method ('setCustomerGroupId ' );
165
+
166
+ $ this ->plugin ->beforeExecute ($ this ->actionMock );
167
+ }
156
168
}
You can’t perform that action at this time.
0 commit comments