Skip to content

Commit

Permalink
ENGCOM-6053: magento/graphql-ce#975: [Test coverage] Cover CartAddres…
Browse files Browse the repository at this point in the history
…sTypeResolver #997
  • Loading branch information
lenaorobei authored Oct 10, 2019
2 parents 268edd9 + 10e5bcb commit 207100a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,42 @@ public function testSetBillingAddressFromAddressBook()
$this->assertSavedBillingAddressFields($billingAddressResponse);
}

/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
*/
public function testVerifyBillingAddressType()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');

$query = <<<QUERY
mutation {
setBillingAddressOnCart(
input: {
cart_id: "$maskedQuoteId"
billing_address: {
customer_address_id: 1
}
}
) {
cart {
billing_address {
__typename
}
}
}
}
QUERY;

$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
$billingAddress = $response['setBillingAddressOnCart']['cart']['billing_address'];
self::assertArrayHasKey('__typename', $billingAddress);
self::assertEquals('BillingCartAddress', $billingAddress['__typename']);
}

/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,44 @@ public function testSetShippingAddressFromAddressBook()

/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
*/
public function testVerifyShippingAddressType()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');

$query = <<<QUERY
mutation {
setShippingAddressesOnCart(
input: {
cart_id: "$maskedQuoteId"
shipping_addresses: [
{
customer_address_id: 1
}
]
}
) {
cart {
shipping_addresses {
__typename
}
}
}
}
QUERY;
$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
$shippingAddresses = current($response['setShippingAddressesOnCart']['cart']['shipping_addresses']);
self::assertArrayHasKey('__typename', $shippingAddresses);
self::assertEquals('ShippingCartAddress', $shippingAddresses['__typename']);
}

/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/Customer/_files/customer_address.php
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
Expand Down

0 comments on commit 207100a

Please sign in to comment.