From 6d71e5c64d476601c5828aeaec34f5ea7c40e3db Mon Sep 17 00:00:00 2001 From: Vaha Date: Sat, 11 May 2019 20:23:51 +0300 Subject: [PATCH 1/4] #682: [Test coverage] added test cases for missed parameters at 'setBillingAddressMutation' --- .../Customer/SetBillingAddressOnCartTest.php | 86 ++++++++++++++++++- .../Guest/SetBillingAddressOnCartTest.php | 81 +++++++++++++++++ ...tishipping_with_two_shipping_addresses.php | 26 ++++++ 3 files changed, 190 insertions(+), 3 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php index fc73d88be1f87..6206a8f4b1209 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php @@ -321,6 +321,89 @@ public function testSetNewBillingAddressAndFromAddressBookAtSameTime() $this->graphQlMutation($query, [], '', $this->getHeaderMap()); } + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.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 testSetNewBillingAddressWithoutCustomerAddressIdAndAddress() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query, [], '', $this->getHeaderMap()); + } + + /** + * @magentoApiDataFixture Magento/Customer/_files/customer.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 + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php + */ + public function testSetNewBillingAddressWithUseForShippingAndMultishipping() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query, [], '', $this->getHeaderMap()); + } + /** * _security * @magentoApiDataFixture Magento/Customer/_files/customer.php @@ -470,9 +553,6 @@ public function testSetBillingAddressOnNonExistentCart() */ public function testSetBillingAddressWithoutRequiredParameters(string $input, string $message) { - $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $input = str_replace('cart_id_value', $maskedQuoteId, $input); - $query = <<getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query); + } + + /** + * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php + * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php + */ + public function testSetNewBillingAddressWithUseForShippingAndMultishipping() + { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + + $query = <<graphQlMutation($query); + } + /** * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php new file mode 100644 index 0000000000000..c7ff96bc7e3d7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php @@ -0,0 +1,26 @@ +get(QuoteFactory::class); +/** @var QuoteResource $quoteResource */ +$quoteResource = Bootstrap::getObjectManager()->get(QuoteResource::class); + +$quote = $quoteFactory->create(); +$quoteResource->load($quote, 'test_quote', 'reserved_order_id'); + +require __DIR__ . '/../../../Multishipping/Fixtures/shipping_address_list.php'; + +/** @var CartRepositoryInterface $quoteRepository */ +$quoteRepository = $objectManager->get(CartRepositoryInterface::class); +$quote->collectTotals(); +$quoteRepository->save($quote); \ No newline at end of file From b8801a063d3aefbe01d253013a9bbf5171215602 Mon Sep 17 00:00:00 2001 From: Vladyslav Podorozhnyi Date: Tue, 4 Jun 2019 23:00:52 +0300 Subject: [PATCH 2/4] #682: [Test coverage] added test cases for missed parameters at 'setBillingAddressMutation' Fix static tests --- .../_files/set_multishipping_with_two_shipping_addresses.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php index c7ff96bc7e3d7..8c9641d6fdc2a 100644 --- a/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php +++ b/dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/set_multishipping_with_two_shipping_addresses.php @@ -18,9 +18,11 @@ $quote = $quoteFactory->create(); $quoteResource->load($quote, 'test_quote', 'reserved_order_id'); +// phpcs:disable require __DIR__ . '/../../../Multishipping/Fixtures/shipping_address_list.php'; +// phpcs:enable /** @var CartRepositoryInterface $quoteRepository */ $quoteRepository = $objectManager->get(CartRepositoryInterface::class); $quote->collectTotals(); -$quoteRepository->save($quote); \ No newline at end of file +$quoteRepository->save($quote); From fd7aba9cdf934d95aa9797872c2c54c9a4003d26 Mon Sep 17 00:00:00 2001 From: Lena Orobei Date: Fri, 7 Jun 2019 17:08:14 -0500 Subject: [PATCH 3/4] magento/graphql-ce#682: [Test coverage] Missed parameters at setBillingAddressMutation - fixed `testSetBillingAddressWithoutRequiredParameters` --- .../GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php index 6206a8f4b1209..a67b237b4db74 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php @@ -553,6 +553,9 @@ public function testSetBillingAddressOnNonExistentCart() */ public function testSetBillingAddressWithoutRequiredParameters(string $input, string $message) { + $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); + $input = str_replace('cart_id_value', $maskedQuoteId, $input); + $query = << Date: Fri, 7 Jun 2019 17:14:24 -0500 Subject: [PATCH 4/4] magento/graphql-ce#682: [Test coverage] Missed parameters at setBillingAddressMutation - fixed code style --- .../GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php index a67b237b4db74..9ff4d3bd0f605 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php @@ -555,7 +555,7 @@ public function testSetBillingAddressWithoutRequiredParameters(string $input, st { $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); $input = str_replace('cart_id_value', $maskedQuoteId, $input); - + $query = <<