Skip to content

Commit 81c88c3

Browse files
authored
Merge ENGCOM-7479 into 2.4-develop-prs
2 parents e4e904e + 3507ca9 commit 81c88c3

File tree

10 files changed

+70
-13
lines changed

10 files changed

+70
-13
lines changed

app/code/Magento/Captcha/Controller/Refresh/Index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\Captcha\Controller\Refresh;
99

1010
use Magento\Captcha\Helper\Data as CaptchaHelper;
11+
use Magento\Framework\App\Action\Action;
12+
use Magento\Framework\App\Action\Context;
1113
use Magento\Framework\App\Action\HttpPostActionInterface;
1214
use Magento\Framework\App\RequestInterface;
1315
use Magento\Framework\Controller\Result\JsonFactory as JsonResultFactory;
@@ -18,7 +20,7 @@
1820
* Refreshes captcha and returns JSON encoded URL to image (AJAX action)
1921
* Example: {'imgSrc': 'http://example.com/media/captcha/67842gh187612ngf8s.png'}
2022
*/
21-
class Index implements HttpPostActionInterface
23+
class Index extends Action implements HttpPostActionInterface
2224
{
2325
/**
2426
* @var CaptchaHelper
@@ -46,19 +48,22 @@ class Index implements HttpPostActionInterface
4648
private $jsonResultFactory;
4749

4850
/**
51+
* @param Context $context
4952
* @param RequestInterface $request
5053
* @param JsonResultFactory $jsonFactory
5154
* @param CaptchaHelper $captchaHelper
5255
* @param LayoutInterface $layout
5356
* @param JsonSerializer $serializer
5457
*/
5558
public function __construct(
59+
Context $context,
5660
RequestInterface $request,
5761
JsonResultFactory $jsonFactory,
5862
CaptchaHelper $captchaHelper,
5963
LayoutInterface $layout,
6064
JsonSerializer $serializer
6165
) {
66+
parent::__construct($context);
6267
$this->request = $request;
6368
$this->jsonResultFactory = $jsonFactory;
6469
$this->captchaHelper = $captchaHelper;

app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Captcha\Controller\Refresh\Index;
1111
use Magento\Captcha\Helper\Data as CaptchaHelper;
1212
use Magento\Captcha\Model\CaptchaInterface;
13+
use Magento\Framework\App\Action\Context;
1314
use Magento\Framework\App\RequestInterface;
1415
use Magento\Framework\Controller\Result\Json as ResultJson;
1516
use Magento\Framework\Controller\Result\JsonFactory as ResultJsonFactory;
@@ -45,6 +46,9 @@ class IndexTest extends TestCase
4546
/** @var MockObject|JsonSerializer */
4647
private $jsonSerializerMock;
4748

49+
/** @var MockObject|Context */
50+
private $contextMock;
51+
4852
/** @var Index */
4953
private $refreshAction;
5054

@@ -66,13 +70,16 @@ protected function setUp(): void
6670
$this->jsonSerializerMock = $this->createMock(JsonSerializer::class);
6771
$this->captchaHelperMock = $this->createMock(CaptchaHelper::class);
6872

73+
$this->contextMock = $this->createMock(Context::class);
74+
6975
$this->blockMock->method('setIsAjax')
7076
->willReturnSelf();
7177

7278
$this->layoutMock->method('createBlock')
7379
->willReturn($this->blockMock);
7480

7581
$this->refreshAction = new Index(
82+
$this->contextMock,
7683
$this->requestMock,
7784
$this->jsonResultFactoryMock,
7885
$this->captchaHelperMock,

app/code/Magento/Checkout/Controller/Sidebar/RemoveItem.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
use Exception;
1111
use Magento\Checkout\Model\Sidebar;
12+
use Magento\Framework\App\Action\Action;
13+
use Magento\Framework\App\Action\Context;
1214
use Magento\Framework\App\Action\HttpPostActionInterface;
1315
use Magento\Framework\App\RequestInterface;
1416
use Magento\Framework\Controller\Result\JsonFactory as ResultJsonFactory;
@@ -17,7 +19,7 @@
1719
use Magento\Framework\Exception\LocalizedException;
1820
use Psr\Log\LoggerInterface;
1921

20-
class RemoveItem implements HttpPostActionInterface
22+
class RemoveItem extends Action implements HttpPostActionInterface
2123
{
2224
/**
2325
* @var RequestInterface
@@ -32,7 +34,7 @@ class RemoveItem implements HttpPostActionInterface
3234
/**
3335
* @var ResultRedirectFactory
3436
*/
35-
private $resultRedirectFactory;
37+
protected $resultRedirectFactory;
3638

3739
/**
3840
* @var Sidebar
@@ -50,6 +52,7 @@ class RemoveItem implements HttpPostActionInterface
5052
protected $logger;
5153

5254
/**
55+
* @param Context $context
5356
* @param RequestInterface $request
5457
* @param ResultJsonFactory $resultJsonFactory
5558
* @param ResultRedirectFactory $resultRedirectFactory
@@ -58,13 +61,15 @@ class RemoveItem implements HttpPostActionInterface
5861
* @param LoggerInterface $logger
5962
*/
6063
public function __construct(
64+
Context $context,
6165
RequestInterface $request,
6266
ResultJsonFactory $resultJsonFactory,
6367
ResultRedirectFactory $resultRedirectFactory,
6468
Sidebar $sidebar,
6569
Validator $formKeyValidator,
6670
LoggerInterface $logger
6771
) {
72+
parent::__construct($context);
6873
$this->request = $request;
6974
$this->resultJsonFactory = $resultJsonFactory;
7075
$this->resultRedirectFactory = $resultRedirectFactory;

app/code/Magento/Cms/Controller/Page/View.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\Cms\Controller\Page;
99

1010
use Magento\Cms\Helper\Page as PageHelper;
11+
use Magento\Framework\App\Action\Action;
12+
use Magento\Framework\App\Action\Context;
1113
use Magento\Framework\App\Action\HttpGetActionInterface;
1214
use Magento\Framework\App\Action\HttpPostActionInterface;
1315
use Magento\Framework\App\RequestInterface;
@@ -17,7 +19,7 @@
1719
/**
1820
* Custom page for storefront. Needs to be accessible by POST because of the store switching.
1921
*/
20-
class View implements HttpGetActionInterface, HttpPostActionInterface
22+
class View extends Action implements HttpGetActionInterface, HttpPostActionInterface
2123
{
2224
/**
2325
* @var ForwardFactory
@@ -35,15 +37,18 @@ class View implements HttpGetActionInterface, HttpPostActionInterface
3537
private $pageHelper;
3638

3739
/**
40+
* @param Context $context
3841
* @param RequestInterface $request
3942
* @param PageHelper $pageHelper
4043
* @param ForwardFactory $resultForwardFactory
4144
*/
4245
public function __construct(
46+
Context $context,
4347
RequestInterface $request,
4448
PageHelper $pageHelper,
4549
ForwardFactory $resultForwardFactory
4650
) {
51+
parent::__construct($context);
4752
$this->request = $request;
4853
$this->pageHelper = $pageHelper;
4954
$this->resultForwardFactory = $resultForwardFactory;

app/code/Magento/Robots/Controller/Index/Index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,31 @@
77

88
namespace Magento\Robots\Controller\Index;
99

10+
use Magento\Framework\App\Action\Action;
11+
use Magento\Framework\App\Action\Context;
1012
use Magento\Framework\App\Action\HttpGetActionInterface;
1113
use Magento\Framework\View\Result\Page;
1214
use Magento\Framework\View\Result\PageFactory;
1315

1416
/**
1517
* Processes request to robots.txt file and returns robots.txt content as result
1618
*/
17-
class Index implements HttpGetActionInterface
19+
class Index extends Action implements HttpGetActionInterface
1820
{
1921
/**
2022
* @var PageFactory
2123
*/
2224
private $resultPageFactory;
2325

2426
/**
27+
* @param Context $context
2528
* @param PageFactory $resultPageFactory
2629
*/
2730
public function __construct(
31+
Context $context,
2832
PageFactory $resultPageFactory
2933
) {
34+
parent::__construct($context);
3035
$this->resultPageFactory = $resultPageFactory;
3136
}
3237

app/code/Magento/Search/Controller/Term/Popular.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
namespace Magento\Search\Controller\Term;
99

10+
use Magento\Framework\App\Action\Action;
11+
use Magento\Framework\App\Action\Context;
1012
use Magento\Framework\App\Action\HttpGetActionInterface;
1113
use Magento\Framework\App\Config\ScopeConfigInterface;
1214
use Magento\Framework\Controller\Result\ForwardFactory as ResultForwardFactory;
@@ -16,7 +18,7 @@
1618
/**
1719
* Popular search terms page
1820
*/
19-
class Popular implements HttpGetActionInterface
21+
class Popular extends Action implements HttpGetActionInterface
2022
{
2123
private const XML_PATH_SEO_SEARCH_TERMS = 'catalog/seo/search_terms';
2224

@@ -36,15 +38,18 @@ class Popular implements HttpGetActionInterface
3638
private $scopeConfig;
3739

3840
/**
41+
* @param Context $context
3942
* @param ResultForwardFactory $resultForwardFactory
4043
* @param ResultPageFactory $resultPageFactory
4144
* @param ScopeConfigInterface $scopeConfig
4245
*/
4346
public function __construct(
47+
Context $context,
4448
ResultForwardFactory $resultForwardFactory,
4549
ResultPageFactory $resultPageFactory,
4650
ScopeConfigInterface $scopeConfig
4751
) {
52+
parent::__construct($context);
4853
$this->resultForwardFactory = $resultForwardFactory;
4954
$this->resultPageFactory = $resultPageFactory;
5055
$this->scopeConfig = $scopeConfig;

app/code/Magento/Swagger/Controller/Index/Index.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77

88
namespace Magento\Swagger\Controller\Index;
99

10+
use Magento\Framework\App\Action\Action;
11+
use Magento\Framework\App\Action\Context;
1012
use Magento\Framework\App\Action\HttpGetActionInterface;
1113
use Magento\Framework\View\Page\Config as PageConfig;
1214
use Magento\Framework\View\Result\PageFactory as PageFactory;
1315

14-
class Index implements HttpGetActionInterface
16+
class Index extends Action implements HttpGetActionInterface
1517
{
1618
/**
1719
* @var PageConfig
@@ -24,11 +26,13 @@ class Index implements HttpGetActionInterface
2426
private $pageFactory;
2527

2628
/**
29+
* @param Context $context
2730
* @param PageConfig $pageConfig
2831
* @param PageFactory $pageFactory
2932
*/
30-
public function __construct(PageConfig $pageConfig, PageFactory $pageFactory)
33+
public function __construct(Context $context, PageConfig $pageConfig, PageFactory $pageFactory)
3134
{
35+
parent::__construct($context);
3236
$this->pageConfig = $pageConfig;
3337
$this->pageFactory = $pageFactory;
3438
}

app/code/Magento/Swagger/Test/Unit/Controller/Index/IndexTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace Magento\Swagger\Test\Unit\Controller\Index;
1010

11+
use Magento\Framework\App\Action\Context;
1112
use Magento\Framework\View\Page\Config as PageConfig;
1213
use Magento\Framework\View\Result\PageFactory;
1314
use Magento\Swagger\Controller\Index\Index;
@@ -18,6 +19,9 @@ class IndexTest extends TestCase
1819
{
1920
public function testExecute()
2021
{
22+
/** @var MockObject|Context $pageConfigMock */
23+
$contextMock = $this->createMock(Context::class);
24+
2125
/** @var MockObject|PageConfig $pageConfigMock */
2226
$pageConfigMock = $this->getMockBuilder(PageConfig::class)
2327
->disableOriginalConstructor()
@@ -30,7 +34,7 @@ public function testExecute()
3034
$pageConfigMock->expects($this->once())->method('addBodyClass')->with('swagger-section');
3135
$resultPageFactory->expects($this->once())->method('create');
3236

33-
$indexAction = new Index($pageConfigMock, $resultPageFactory);
37+
$indexAction = new Index($contextMock, $pageConfigMock, $resultPageFactory);
3438
$indexAction->execute();
3539
}
3640
}

app/code/Magento/Version/Controller/Index/Index.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
namespace Magento\Version\Controller\Index;
99

10+
use Magento\Framework\App\Action\Action;
11+
use Magento\Framework\App\Action\Context;
1012
use Magento\Framework\App\Action\HttpGetActionInterface;
1113
use Magento\Framework\App\ProductMetadataInterface;
1214
use Magento\Framework\Controller\Result\RawFactory as RawResponseFactory;
1315

1416
/**
1517
* Magento Version controller: Sets the response body to ProductName/Major.MinorVersion (Edition).
1618
*/
17-
class Index implements HttpGetActionInterface
19+
class Index extends Action implements HttpGetActionInterface
1820
{
1921
const DEV_PREFIX = 'dev-';
2022

@@ -29,11 +31,16 @@ class Index implements HttpGetActionInterface
2931
private $rawFactory;
3032

3133
/**
34+
* @param Context $context
3235
* @param RawResponseFactory $rawFactory
3336
* @param ProductMetadataInterface $productMetadata
3437
*/
35-
public function __construct(RawResponseFactory $rawFactory, ProductMetadataInterface $productMetadata)
36-
{
38+
public function __construct(
39+
Context $context,
40+
RawResponseFactory $rawFactory,
41+
ProductMetadataInterface $productMetadata
42+
) {
43+
parent::__construct($context);
3744
$this->rawFactory = $rawFactory;
3845
$this->productMetadata = $productMetadata;
3946
}

app/code/Magento/Version/Test/Unit/Controller/Index/IndexTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Version\Test\Unit\Controller\Index;
99

10+
use Magento\Framework\App\Action\Context;
1011
use Magento\Framework\App\ProductMetadataInterface;
1112
use Magento\Framework\Controller\Result\Raw;
1213
use Magento\Framework\Controller\Result\RawFactory;
@@ -28,11 +29,16 @@ class IndexTest extends TestCase
2829
/** @var MockObject|Raw */
2930
private $rawResponseMock;
3031

32+
/** @var MockObject|Context */
33+
private $contextMock;
34+
3135
/**
3236
* Prepare test preconditions
3337
*/
3438
protected function setUp(): void
3539
{
40+
$this->contextMock = $this->createMock(Context::class);
41+
3642
$this->productMetadataMock = $this->getMockBuilder(ProductMetadataInterface::class)
3743
->disableOriginalConstructor()
3844
->setMethods(['getName', 'getEdition', 'getVersion'])
@@ -42,7 +48,11 @@ protected function setUp(): void
4248
$this->rawResponseMock = $this->createPartialMock(Raw::class, ['setContents']);
4349
$this->rawResponseFactoryMock->method('create')->willReturn($this->rawResponseMock);
4450

45-
$this->versionController = new VersionIndex($this->rawResponseFactoryMock, $this->productMetadataMock);
51+
$this->versionController = new VersionIndex(
52+
$this->contextMock,
53+
$this->rawResponseFactoryMock,
54+
$this->productMetadataMock
55+
);
4656
}
4757

4858
/**

0 commit comments

Comments
 (0)