Skip to content

Commit f7ab08e

Browse files
author
Vitaliy Boyko
committed
graphQl-890: fixed static tests
1 parent b3f510d commit f7ab08e

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,29 @@ public function testAddSimpleProductToCart()
5555
self::assertArrayHasKey('prices', $response['addSimpleProductsToCart']['cart']['items'][0]);
5656

5757
self::assertArrayHasKey('price', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']);
58-
self::assertArrayHasKey('value', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price']);
59-
self::assertEquals(10, $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price']['value']);
60-
self::assertEquals('USD', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price']['currency']);
58+
$price = $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price'];
59+
self::assertArrayHasKey('value', $price);
60+
self::assertEquals(10, $price['value']);
61+
self::assertArrayHasKey('currency', $price);
62+
self::assertEquals('USD', $price['currency']);
6163

6264
self::assertArrayHasKey('row_total', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']);
63-
self::assertArrayHasKey('value', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total']);
64-
self::assertEquals(20, $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total']['value']);
65-
self::assertEquals('USD', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total']['currency']);
65+
$rowTotal = $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total'];
66+
self::assertArrayHasKey('value', $rowTotal);
67+
self::assertEquals(20, $rowTotal['value']);
68+
self::assertArrayHasKey('currency', $rowTotal);
69+
self::assertEquals('USD', $rowTotal['currency']);
6670

67-
self::assertArrayHasKey('row_total_including_tax', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']);
68-
self::assertArrayHasKey('value', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax']);
69-
self::assertEquals(20, $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax']['value']);
70-
self::assertEquals('USD', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax']['currency']);
71+
self::assertArrayHasKey(
72+
'row_total_including_tax',
73+
$response['addSimpleProductsToCart']['cart']['items'][0]['prices']
74+
);
75+
$rowTotalIncludingTax =
76+
$response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax'];
77+
self::assertArrayHasKey('value', $rowTotalIncludingTax);
78+
self::assertEquals(20, $rowTotalIncludingTax['value']);
79+
self::assertArrayHasKey('currency', $rowTotalIncludingTax);
80+
self::assertEquals('USD', $rowTotalIncludingTax['currency']);
7181
}
7282

7383
/**

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,29 @@ public function testAddSimpleProductToCart()
5050
self::assertArrayHasKey('prices', $response['addSimpleProductsToCart']['cart']['items'][0]);
5151

5252
self::assertArrayHasKey('price', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']);
53-
self::assertArrayHasKey('value', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price']);
54-
self::assertEquals(10, $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price']['value']);
55-
self::assertEquals('USD', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price']['currency']);
53+
$price = $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['price'];
54+
self::assertArrayHasKey('value', $price);
55+
self::assertEquals(10, $price['value']);
56+
self::assertArrayHasKey('currency', $price);
57+
self::assertEquals('USD', $price['currency']);
5658

5759
self::assertArrayHasKey('row_total', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']);
58-
self::assertArrayHasKey('value', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total']);
59-
self::assertEquals(20, $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total']['value']);
60-
self::assertEquals('USD', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total']['currency']);
60+
$rowTotal = $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total'];
61+
self::assertArrayHasKey('value', $rowTotal);
62+
self::assertEquals(20, $rowTotal['value']);
63+
self::assertArrayHasKey('currency', $rowTotal);
64+
self::assertEquals('USD', $rowTotal['currency']);
6165

62-
self::assertArrayHasKey('row_total_including_tax', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']);
63-
self::assertArrayHasKey('value', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax']);
64-
self::assertEquals(20, $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax']['value']);
65-
self::assertEquals('USD', $response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax']['currency']);
66+
self::assertArrayHasKey(
67+
'row_total_including_tax',
68+
$response['addSimpleProductsToCart']['cart']['items'][0]['prices']
69+
);
70+
$rowTotalIncludingTax =
71+
$response['addSimpleProductsToCart']['cart']['items'][0]['prices']['row_total_including_tax'];
72+
self::assertArrayHasKey('value', $rowTotalIncludingTax);
73+
self::assertEquals(20, $rowTotalIncludingTax['value']);
74+
self::assertArrayHasKey('currency', $rowTotalIncludingTax);
75+
self::assertEquals('USD', $rowTotalIncludingTax['currency']);
6676
}
6777

6878
/**

0 commit comments

Comments
 (0)