Skip to content

Commit 65ed522

Browse files
committed
MC-16922: Create an end-to-end test SetPaymentMethodOnCart for the authorize.net payment method
- fixed static failures
1 parent 04cf11a commit 65ed522

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void
143143
$this->request->setHeaders($webApiRequest->getHeaders());
144144
$graphql = $this->objectManager->get(\Magento\GraphQl\Controller\GraphQl::class);
145145

146+
// phpcs:ignore Magento2.Security.IncludeFile
146147
$expectedRequest = include __DIR__ . '/../../../_files/request_authorize_customer.php';
148+
// phpcs:ignore Magento2.Security.IncludeFile
147149
$authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php';
148150

149151
$this->clientMock->method('setRawData')

dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @magentoDbIsolation disabled
2323
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2424
*/
25-
class SetAuthorizenetPaymentMethodOnCartTest extends TestCase
25+
class SetAuthorizeNetPaymentMethodOnCartTest extends TestCase
2626
{
2727
const CONTENT_TYPE = 'application/json';
2828

dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ protected function setUp() : void
9595
*/
9696
public function testDispatchToPlaceAnOrderWithAuthorizenet(): void
9797
{
98-
$paymentMethod = 'authorizenet_acceptjs';
99-
$cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
100-
$query
98+
$paymentMethod = 'authorizenet_acceptjs';
99+
$cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
100+
$query
101101
= <<<QUERY
102102
mutation {
103103
setPaymentMethodOnCart(input: {
@@ -135,8 +135,9 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void
135135
$headers = $this->objectManager->create(\Zend\Http\Headers::class)
136136
->addHeaders(['Content-Type' => 'application/json']);
137137
$this->request->setHeaders($headers);
138-
138+
// phpcs:ignore Magento2.Security.IncludeFile
139139
$expectedRequest = include __DIR__ . '/../../../_files/request_authorize.php';
140+
// phpcs:ignore Magento2.Security.IncludeFile
140141
$authorizeResponse = include __DIR__ . '/../../../_files/response_authorize.php';
141142

142143
$this->clientMock->method('setRawData')
@@ -147,7 +148,7 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void
147148
$response = $this->graphql->dispatch($this->request);
148149
$responseData = $this->jsonSerializer->unserialize($response->getContent());
149150

150-
$this->assertArrayNotHasKey('errors', $responseData, 'Response has errors');
151+
$this->assertArrayNotHasKey('errors', $responseData, 'Response has errors');
151152
$this->assertTrue(
152153
isset($responseData['data']['setPaymentMethodOnCart']['cart']['selected_payment_method']['code'])
153154
);

dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@
3636
/** Out of interface */
3737
$product
3838
->setWebsiteIds([1])
39-
->setStockData([
39+
->setStockData(
40+
[
4041
'qty' => 85.5,
4142
'is_in_stock' => true,
4243
'manage_stock' => true,
4344
'is_qty_decimal' => true
44-
]);
45+
]
46+
);
4547
$productRepository->save($product);

dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/_files/simple_product_authorizenet_rollback.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
// phpcs:ignore Magento2.Security.IncludeFile
78
require __DIR__ . '/../../GraphQl/Catalog/_files/simple_product_rollback.php';

0 commit comments

Comments
 (0)