@@ -68,6 +68,14 @@ protected function setUp()
6868 */
6969 public function testExecuteWithPaymentOperation ()
7070 {
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+
7179 $ quote = $ this ->getQuote ('2000000001 ' );
7280 $ session = $ this ->_objectManager ->get (Quote::class);
7381 $ session ->setQuoteId ($ quote ->getId ());
@@ -82,14 +90,6 @@ public function testExecuteWithPaymentOperation()
8290 $ this ->getRequest ()->setMethod (Http::METHOD_POST );
8391 $ this ->getRequest ()->setPostValue (['order ' => $ data ]);
8492
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-
9393 $ this ->dispatch ('backend/sales/order_create/save ' );
9494 $ this ->assertSessionMessages (
9595 self ::equalTo (['Transaction has been declined. ' ]),
0 commit comments