Skip to content

Commit 37d6d71

Browse files
committed
Merge branch 'AC-3525' of github.com:magento-cia/magento2ce into cia-2.4.6-bugfixes-07132022
2 parents 369ebbe + bf25176 commit 37d6d71

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

app/code/Magento/Cms/Controller/Noroute/Index.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
8+
79
namespace Magento\Cms\Controller\Noroute;
810

11+
use Magento\Framework\Controller\Result\ForwardFactory;
12+
913
/**
1014
* @SuppressWarnings(PHPMD.AllPurposeAction)
1115
*/
1216
class Index extends \Magento\Framework\App\Action\Action
1317
{
1418
/**
15-
* @var \Magento\Framework\Controller\Result\ForwardFactory
19+
* @var ForwardFactory
1620
*/
17-
protected $resultForwardFactory;
21+
protected ForwardFactory $resultForwardFactory;
1822

1923
/**
2024
* @param \Magento\Framework\App\Action\Context $context
@@ -48,6 +52,7 @@ public function execute()
4852
if ($resultPage) {
4953
$resultPage->setStatusHeader(404, '1.1', 'Not Found');
5054
$resultPage->setHeader('Status', '404 File not found');
55+
$resultPage->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0', true);
5156
return $resultPage;
5257
} else {
5358
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */

app/code/Magento/Cms/Test/Unit/Controller/Noroute/IndexTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ class IndexTest extends TestCase
2929
/**
3030
* @var Index
3131
*/
32-
protected $_controller;
32+
protected Index $_controller;
3333

3434
/**
3535
* @var MockObject
3636
*/
37-
protected $_cmsHelperMock;
37+
protected MockObject $_cmsHelperMock;
3838

3939
/**
4040
* @var MockObject
4141
*/
42-
protected $_requestMock;
42+
protected MockObject $_requestMock;
4343

4444
/**
4545
* @var ForwardFactory|MockObject
@@ -119,10 +119,14 @@ public function testExecuteResultPage(): void
119119
->method('setStatusHeader')
120120
->with(404, '1.1', 'Not Found')
121121
->willReturn($this->resultPageMock);
122+
122123
$this->resultPageMock
123124
->method('setHeader')
124-
->with('Status', '404 File not found')
125-
->willReturn($this->resultPageMock);
125+
->withConsecutive(
126+
['Status', '404 File not found'],
127+
['Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0']
128+
)->willReturn($this->resultPageMock);
129+
126130
$this->_cmsHelperMock->expects(
127131
$this->once()
128132
)->method(

0 commit comments

Comments
 (0)