Skip to content

Commit fe9f854

Browse files
committed
Merge remote-tracking branch 'origin/MC-16410' into 2.2.9-develop-pr97
2 parents 8bb6add + 557de99 commit fe9f854

File tree

2 files changed

+32
-5
lines changed
  • app/code/Magento/Sales/Controller/Guest
  • dev/tests/integration/testsuite/Magento/Sales/Controller/Guest

2 files changed

+32
-5
lines changed

app/code/Magento/Sales/Controller/Guest/View.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ public function __construct(
5353
*/
5454
public function execute()
5555
{
56-
if (!$this->getRequest()->isPost()) {
57-
throw new \Magento\Framework\Exception\NotFoundException(__('Page not found.'));
58-
}
59-
if (!$this->formKeyValidator->validate($this->getRequest())) {
60-
return $this->resultRedirectFactory->create()->setPath('*/*/form/');
56+
if ($this->getRequest()->isPost()) {
57+
if (!$this->formKeyValidator->validate($this->getRequest())) {
58+
return $this->resultRedirectFactory->create()->setPath('*/*/form/');
59+
}
6160
}
6261

6362
$result = $this->guestHelper->loadValidOrder($this->getRequest());
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Sales\Controller\Guest;
9+
10+
use Magento\TestFramework\Request;
11+
use Magento\TestFramework\TestCase\AbstractController;
12+
13+
/**
14+
* Test for \Magento\Sales\Controller\Guest\View class.
15+
*/
16+
class ViewTest extends AbstractController
17+
{
18+
/**
19+
* Check that controller applied GET requests.
20+
*/
21+
public function testExecuteWithGetRequest()
22+
{
23+
$this->getRequest()->setMethod(Request::METHOD_GET);
24+
$this->dispatch('sales/guest/view/');
25+
26+
$this->assertRedirect($this->stringContains('sales/guest/form'));
27+
}
28+
}

0 commit comments

Comments
 (0)