@@ -68,6 +68,14 @@ protected function setUp()
68
68
*/
69
69
public function testExecuteWithPaymentOperation ()
70
70
{
71
+ /** @var OrderService|MockObject $orderService */
72
+ $ orderService = $ this ->getMockBuilder (OrderService::class)
73
+ ->disableOriginalConstructor ()
74
+ ->getMock ();
75
+ $ orderService ->method ('place ' )
76
+ ->willThrowException (new LocalizedException (__ ('Transaction has been declined. ' )));
77
+ $ this ->_objectManager ->addSharedInstance ($ orderService , OrderService::class);
78
+
71
79
$ quote = $ this ->getQuote ('2000000001 ' );
72
80
$ session = $ this ->_objectManager ->get (Quote::class);
73
81
$ session ->setQuoteId ($ quote ->getId ());
@@ -82,14 +90,6 @@ public function testExecuteWithPaymentOperation()
82
90
$ this ->getRequest ()->setMethod (Http::METHOD_POST );
83
91
$ this ->getRequest ()->setPostValue (['order ' => $ data ]);
84
92
85
- /** @var OrderService|MockObject $orderService */
86
- $ orderService = $ this ->getMockBuilder (OrderService::class)
87
- ->disableOriginalConstructor ()
88
- ->getMock ();
89
- $ orderService ->method ('place ' )
90
- ->willThrowException (new LocalizedException (__ ('Transaction has been declined. ' )));
91
- $ this ->_objectManager ->addSharedInstance ($ orderService , OrderService::class);
92
-
93
93
$ this ->dispatch ('backend/sales/order_create/save ' );
94
94
$ this ->assertSessionMessages (
95
95
self ::equalTo (['Transaction has been declined. ' ]),
0 commit comments