Skip to content

Commit fa7e07f

Browse files
committed
MC-17592: End-to-end integration to test order with Payflow Link
1 parent 1f17b9d commit fa7e07f

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowLinkTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ protected function setUp()
8686
$this->objectManager->addSharedInstance($this->gateway, Gateway::class);
8787
}
8888

89+
/**
90+
* @inheritdoc
91+
*/
92+
protected function tearDown()
93+
{
94+
$this->objectManager->removeSharedInstance(Gateway::class);
95+
}
96+
8997
/**
9098
* Test place order with payflow link
9199
*
@@ -154,8 +162,7 @@ public function testResolvePlaceOrderWithPayflowLinkForCustomer(): void
154162
->method('postRequest')
155163
->willReturn($payflowLinkResponse);
156164

157-
$this->payflowRequest->expects($this->any())
158-
->method('setData')
165+
$this->payflowRequest->method('setData')
159166
->willReturnMap(
160167
[
161168
[
@@ -198,12 +205,4 @@ public function testResolvePlaceOrderWithPayflowLinkForCustomer(): void
198205
$responseData['data']['placeOrder']['order']['order_id']
199206
);
200207
}
201-
202-
/**
203-
* @inheritdoc
204-
*/
205-
protected function tearDown()
206-
{
207-
$this->objectManager->removeSharedInstance(Gateway::class);
208-
}
209208
}

dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PlaceOrderWithPayflowLinkTest.php

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,28 @@ protected function setUp()
6969
->disableOriginalConstructor()
7070
->setMethods(['__call','setData'])
7171
->getMock();
72-
$this->payflowRequest->expects($this->any())
73-
->method('__call')
74-
->will(
75-
$this->returnCallback(
76-
function ($method) {
77-
if (strpos($method, 'set') === 0) {
78-
return $this->payflowRequest;
79-
}
80-
return null;
72+
$this->payflowRequest->method('__call')
73+
->willReturnCallback(
74+
function ($method) {
75+
if (strpos($method, 'set') === 0) {
76+
return $this->payflowRequest;
8177
}
82-
)
78+
return null;
79+
}
8380
);
8481

85-
$requestFactory->expects($this->any())->method('create')->will($this->returnValue($this->payflowRequest));
82+
$requestFactory->expects($this->any())->method('create')->willReturn($this->payflowRequest);
8683
$this->objectManager->addSharedInstance($this->gateway, Gateway::class);
8784
}
8885

86+
/**
87+
* @inheritdoc
88+
*/
89+
protected function tearDown()
90+
{
91+
$this->objectManager->removeSharedInstance(Gateway::class);
92+
}
93+
8994
/**
9095
* Test successful place Order with Payflow link
9196
*
@@ -260,7 +265,8 @@ public function testResolveWithPayflowLinkDeclined(): void
260265

261266
]
262267
]
263-
)->willReturnSelf();
268+
)
269+
->willReturnSelf();
264270

265271
$this->gateway->method('postRequest')->willThrowException($exception);
266272

@@ -274,12 +280,4 @@ public function testResolveWithPayflowLinkDeclined(): void
274280
);
275281
$this->assertEquals(GraphQlInputException::EXCEPTION_CATEGORY, $actualError['category']);
276282
}
277-
278-
/**
279-
* @inheritdoc
280-
*/
281-
protected function tearDown()
282-
{
283-
$this->objectManager->removeSharedInstance(Gateway::class);
284-
}
285283
}

0 commit comments

Comments
 (0)