Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magento/magento2#: GraphQl. setShippingAddressesOnCart. Test coverage for The shipping address must contain either "customer_address_id" or "address". error. #28492

Conversation

atwixfirster
Copy link
Contributor

@atwixfirster atwixfirster commented Jun 3, 2020

Description (*)

Provide a fix in the logic which allow to appear The shipping address must contain either "customer_address_id" or "address". error.

Because now, if input.shipping_addresses.customer_address_id contains a NULL and input.shipping_addresses.address is not set

mutation {
  setShippingAddressesOnCart(
    input: {
      cart_id: "VMN1fwdjwUxF71Mxe0maZZI6Dj3qGmm3"
      shipping_addresses: [
        {
          customer_address_id: null
        }
      ]
    }
  ) {
    cart {
      shipping_addresses {
        city
      }
    }
  }
}

then \Magento\QuoteGraphQl\Model\Cart\SetShippingAddressesOnCart::execute creates an empty $shippingAddressInput['address'] and sets

$shippingAddressInput['address']['save_in_address_book'] = true;

which is not correct.

Also, PR adds the API-functional test to cover a mentioned error.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

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 are green)

Thank you!

@m2-assistant
Copy link

m2-assistant bot commented Jun 3, 2020

Hi @atwixfirster. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@magento-engcom-team magento-engcom-team added Component: QuoteGraphQl Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jun 3, 2020
@atwixfirster atwixfirster changed the title magento/magento2#: GraphQl. setShippingAddressesOnCart. Test coveragefor The shipping address must contain either "customer_address_id" or "address". error. magento/magento2#: GraphQl. setShippingAddressesOnCart. Test coverage for The shipping address must contain either "customer_address_id" or "address". error. Jun 3, 2020
@dmytro-ch dmytro-ch self-assigned this Jun 3, 2020
@atwixfirster
Copy link
Contributor Author

@magento run all tests

@atwixfirster
Copy link
Contributor Author

@magento run Static Tests

@atwixfirster
Copy link
Contributor Author

@magento run Unit Tests, Database Compare, WebAPI Tests

… for `The shipping address must contain either "customer_address_id" or "address".` error.
@atwixfirster atwixfirster force-pushed the graphql-setShippingAddressesOnCart branch from d5dd519 to 0d356ac Compare June 4, 2020 21:16
@atwixfirster
Copy link
Contributor Author

@magento run Static Tests

@atwixfirster
Copy link
Contributor Author

@magento run Unit Tests, Database Compare, WebAPI Tests

@dmytro-ch
Copy link
Contributor

@magento run all tests

@dmytro-ch dmytro-ch added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: test coverage labels Jun 10, 2020
@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch, thank you for the review.
ENGCOM-7659 has been created to process this Pull Request

@nrkapoor nrkapoor requested a review from avattam06 June 11, 2020 12:59
@nrkapoor nrkapoor added this to the 2.4.1 milestone Jun 11, 2020
@avattam06
Copy link
Contributor

@magento run all tests

@avattam06
Copy link
Contributor

@magento run unit tests

@avattam06
Copy link
Contributor

@magento run all tests

magento-engcom-team pushed a commit that referenced this pull request Jun 27, 2020
…Test coverage for `The shipping address must contain either "customer_address_id" or "address".` error. #28492
@magento-engcom-team magento-engcom-team merged commit c2ecf27 into magento:2.4-develop Jun 27, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 27, 2020

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.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: test coverage Component: QuoteGraphQl Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Progress: accept Project: GraphQL Release Line: 2.4
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants