Skip to content

Commit ab226a4

Browse files
committed
Merge remote-tracking branch 'origin/imported-magento-magento2-32326' into 2.4-develop-pr134
2 parents 6561fe0 + 1455889 commit ab226a4

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/internal/Magento/Framework/App/FrontController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ private function processRequest(
184184

185185
//Validating a request only once.
186186
if (!$this->validatedRequest) {
187+
$area = $this->areaList->getArea($this->appState->getAreaCode());
188+
$area->load(Area::PART_DESIGN);
189+
$area->load(Area::PART_TRANSLATE);
190+
187191
try {
188192
$this->requestValidator->validate($request, $actionInstance);
189193
} catch (InvalidRequestException $exception) {
@@ -193,9 +197,6 @@ private function processRequest(
193197
["exception" => $exception]
194198
);
195199
$result = $exception->getReplaceResult();
196-
$area = $this->areaList->getArea($this->appState->getAreaCode());
197-
$area->load(Area::PART_DESIGN);
198-
$area->load(Area::PART_TRANSLATE);
199200
if ($messages = $exception->getMessages()) {
200201
foreach ($messages as $message) {
201202
$this->messages->addErrorMessage($message);

lib/internal/Magento/Framework/App/Test/Unit/FrontControllerTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ public function testDispatched()
226226
$this->routerList->expects($this->any())
227227
->method('current')
228228
->willReturn($this->router);
229-
229+
$this->appStateMock->expects($this->any())->method('getAreaCode')->willReturn('frontend');
230+
$this->areaMock->expects($this->at(0))->method('load')->with(Area::PART_DESIGN)->willReturnSelf();
231+
$this->areaMock->expects($this->at(1))->method('load')->with(Area::PART_TRANSLATE)->willReturnSelf();
232+
$this->areaListMock->expects($this->any())->method('getArea')->willReturn($this->areaMock);
230233
$this->request->expects($this->at(0))->method('isDispatched')->willReturn(false);
231234
$this->request->expects($this->at(1))->method('setDispatched')->with(true);
232235
$this->request->expects($this->at(2))->method('isDispatched')->willReturn(true);
@@ -261,6 +264,10 @@ public function testDispatchedNotFoundException()
261264
->method('current')
262265
->willReturn($this->router);
263266

267+
$this->appStateMock->expects($this->any())->method('getAreaCode')->willReturn('frontend');
268+
$this->areaMock->expects($this->at(0))->method('load')->with(Area::PART_DESIGN)->willReturnSelf();
269+
$this->areaMock->expects($this->at(1))->method('load')->with(Area::PART_TRANSLATE)->willReturnSelf();
270+
$this->areaListMock->expects($this->any())->method('getArea')->willReturn($this->areaMock);
264271
$this->request->expects($this->at(0))->method('isDispatched')->willReturn(false);
265272
$this->request->expects($this->at(1))->method('initForward');
266273
$this->request->expects($this->at(2))->method('setActionName')->with('noroute');

0 commit comments

Comments
 (0)