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

Add API functional tests for ApplyCouponToCart functionality #558

Conversation

dmytro-ch
Copy link
Contributor

@dmytro-ch dmytro-ch commented Apr 1, 2019

Description (*)

Fixed Issues (if relevant)

  1. [Test Coverage] 'ApplyCouponToCart' functionality #479: [Test Coverage] 'ApplyCouponToCart' functionality

Manual testing scenarios (*)

N/A

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@dmytro-ch dmytro-ch assigned dmytro-ch and naydav and unassigned dmytro-ch Apr 1, 2019
/**
* @var CouponResourceInterface
*/
protected $couponResource;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, check and remove all of unused dependencies like this

* @param string $sku
* @throws \Exception
*/
private function excludeProductPerCoupon(string $couponCode, string $sku)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this set-up to fixture file (with rollback)?

Example:

/**
     * @magentoApiDataFixture Magento/Customer/_files/customer.php
     * @magentoApiDataFixture Magento/Catalog/_files/product_simple.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_new_shipping_address.php
     */

'test_order_with_simple_product_without_address',
'reserved_order_id'
);
$maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we can avoid manipulating with QuoteResource (etc..) if we will reuse current fixtures

/**
     * @magentoApiDataFixture Magento/Customer/_files/customer.php
     * @magentoApiDataFixture Magento/Catalog/_files/product_simple.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_new_shipping_address.php
     */

@naydav
Copy link
Contributor

naydav commented Apr 3, 2019

@dmytro-ch
I finished one more related example
https://github.com/magento/graphql-ce/pull/497/files

…to-cart

# Conflicts:
#	dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/CouponTest.php
@dmytro-ch
Copy link
Contributor Author

Hello @naydav,
thank you for reviewing this PR.
I've applied the changes according to the recommendations.

Thank you!

@ghost
Copy link

ghost commented Apr 9, 2019

Hi @dmytro-ch, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants