File tree Expand file tree Collapse file tree 3 files changed +35
-8
lines changed
Test/Unit/Controller/Guest
dev/tests/integration/testsuite/Magento/Sales/Controller/Guest Expand file tree Collapse file tree 3 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,13 @@ public function __construct(
49
49
50
50
/**
51
51
* @return \Magento\Framework\Controller\ResultInterface
52
- * @throws \Magento\Framework\Exception\NotFoundException
53
52
*/
54
53
public function execute ()
55
54
{
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/ ' );
55
+ if ($ this ->getRequest ()->isPost ()) {
56
+ if (!$ this ->formKeyValidator ->validate ($ this ->getRequest ())) {
57
+ return $ this ->resultRedirectFactory ->create ()->setPath ('*/*/form/ ' );
58
+ }
61
59
}
62
60
63
61
$ result = $ this ->guestHelper ->loadValidOrder ($ this ->getRequest ());
Original file line number Diff line number Diff line change @@ -145,13 +145,15 @@ public function testExecuteOrderNotFound()
145
145
146
146
/**
147
147
* @return void
148
- * @expectedException \Magento\Framework\Exception\NotFoundException
149
- * @expectedExceptionMessage Page not found.
150
148
*/
151
149
public function testExecuteWithNonPostRequest ()
152
150
{
153
151
$ this ->requestMock ->expects ($ this ->once ())->method ('isPost ' )->willReturn (false );
154
152
153
+ $ this ->resultPageFactoryMock ->expects ($ this ->once ())
154
+ ->method ('create ' )
155
+ ->willReturn ($ this ->resultPageMock );
156
+
155
157
$ this ->viewController ->execute ();
156
158
}
157
159
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Sales \Controller \Guest ;
8
+
9
+ use Magento \TestFramework \Request ;
10
+ use Magento \TestFramework \TestCase \AbstractController ;
11
+
12
+ /**
13
+ * Test for \Magento\Sales\Controller\Guest\View class.
14
+ */
15
+ class ViewTest extends AbstractController
16
+ {
17
+ /**
18
+ * Check that controller applied GET requests.
19
+ */
20
+ public function testExecuteWithGetRequest ()
21
+ {
22
+ $ this ->getRequest ()->setMethod (Request::METHOD_GET );
23
+ $ this ->dispatch ('sales/guest/view/ ' );
24
+
25
+ $ this ->assertRedirect ($ this ->stringContains ('sales/guest/form ' ));
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments