Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit 493d744

Browse files
committed
#975: [Test coverage] Cover CartAddressTypeResolver
1 parent 68c48d5 commit 493d744

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,42 @@ public function testSetBillingAddressFromAddressBook()
239239
$this->assertSavedBillingAddressFields($billingAddressResponse);
240240
}
241241

242+
/**
243+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
244+
* @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php
245+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
246+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
247+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
248+
*/
249+
public function testVerifyBillingAddressType()
250+
{
251+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
252+
253+
$query = <<<QUERY
254+
mutation {
255+
setBillingAddressOnCart(
256+
input: {
257+
cart_id: "$maskedQuoteId"
258+
billing_address: {
259+
customer_address_id: 1
260+
}
261+
}
262+
) {
263+
cart {
264+
billing_address {
265+
__typename
266+
}
267+
}
268+
}
269+
}
270+
QUERY;
271+
272+
$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
273+
$billingAddress = $response['setBillingAddressOnCart']['cart']['billing_address'];
274+
self::assertArrayHasKey('__typename', $billingAddress);
275+
self::assertEquals('BillingCartAddress', $billingAddress['__typename']);
276+
}
277+
242278
/**
243279
* @magentoApiDataFixture Magento/Customer/_files/customer.php
244280
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,44 @@ public function testSetShippingAddressFromAddressBook()
213213

214214
/**
215215
* @magentoApiDataFixture Magento/Customer/_files/customer.php
216+
* @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php
217+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
218+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
219+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
220+
*/
221+
public function testVerifyShippingAddressType()
222+
{
223+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
224+
225+
$query = <<<QUERY
226+
mutation {
227+
setShippingAddressesOnCart(
228+
input: {
229+
cart_id: "$maskedQuoteId"
230+
shipping_addresses: [
231+
{
232+
customer_address_id: 1
233+
}
234+
]
235+
}
236+
) {
237+
cart {
238+
shipping_addresses {
239+
__typename
240+
}
241+
}
242+
}
243+
}
244+
QUERY;
245+
$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
246+
$shippingAddresses = current($response['setShippingAddressesOnCart']['cart']['shipping_addresses']);
247+
self::assertArrayHasKey('__typename', $shippingAddresses);
248+
self::assertEquals('ShippingCartAddress', $shippingAddresses['__typename']);
249+
}
250+
251+
/**
252+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
253+
* @magentoApiDataFixture Magento/Customer/_files/customer_address.php
216254
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
217255
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
218256
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php

0 commit comments

Comments
 (0)