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

420 test coverage get available payment methods guest #450

Conversation

atwixfirster
Copy link
Contributor

Test coverage: GetAvailablePaymentMethodsTest for Guest #420

Pull request covers next cases:

  • testGetPaymentMethodsFromGuestCart (get available payment methods for the guest's shopping cart)
  • testGetPaymentMethodsFromAnotherCustomerCart (get available payment methods from the shopping cart of another user)
  • testGetPaymentMethodsIfPaymentsAreNotSet (check available payment methods when all payment methods are disabled)
  • testGetPaymentMethodsOfNonExistentCart (shopping cart does not exist)

Issue: #420

1. Add
- testGetPaymentMethodsFromGuestCart()
- testGetPaymentMethodsFromAnotherCustomerCart()
- testGetPaymentMethodsIfPaymentsAreNotSet()
- testGetPaymentMethodsOfNonExistentCart()
to \Magento\GraphQl\Quote\\Guest\GetAvailablePaymentMethodsTest
1. Add Magento/Payment/_files/disable_all_active_payment_methods.php
$processConfigData = function (Config $config, array $data) {
foreach ($data as $key => $value) {
$config->setDataByPath($key, $value);
$config->save();
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 don't need to call save after each iteration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like we don't need to call save after each iteration

@naydav , I've debugged your suggestions and I want inform you that we should use $config->save(); after each $config->setDataByPath($key, $value); if we want to save all config params.

By the way, the same approach uses in:

  • dev/tests/integration/testsuite/Magento/Braintree/_files/payment_configuration.php
  • dev/tests/integration/testsuite/Magento/Paypal/Fixtures/process_config_data.php
  • dev/tests/integration/testsuite/Magento/SendFriend/Fixtures/process_config_data.php
  • dev/tests/integration/testsuite/Magento/Signifyd/_files/website_configuration.php

Please approve and merge ;)

Thank you!

atwixfirster and others added 2 commits March 13, 2019 10:54
Merge remote-tracking branch 'origin/2.3-develop' into 420-test-coverage-getAvailablePaymentMethods-guest

# Conflicts:
#	dev/tests/integration/testsuite/Magento/Payment/_files/disable_all_active_payment_methods.php
#	dev/tests/integration/testsuite/Magento/Payment/_files/disable_all_active_payment_methods_rollback.php
@ghost
Copy link

ghost commented Mar 13, 2019

Hi @atwixfirster, 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.

@naydav naydav deleted the 420-test-coverage-getAvailablePaymentMethods-guest branch April 12, 2019 19:34
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