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

Throw InputException if 'country_code'-parameter is missing #1044

Conversation

hAmpzter
Copy link

@hAmpzter hAmpzter commented Oct 31, 2019

Description (*)

Made changes according to wanted result in issue. Throws error if country_code-parameter is missing.

Fixed Issues (if relevant)

  1. Notice: Undefined index: country_code #1041: Notice: Undefined index: country_code

Manual testing scenarios (*)

  1. Set a shipping adress without country_code

Questions or comments

See comment/question in issue: #1041 (comment)

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)

@hAmpzter hAmpzter closed this Oct 31, 2019
@ghost
Copy link

ghost commented Oct 31, 2019

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

@hAmpzter hAmpzter reopened this Oct 31, 2019
@TomashKhamlai
Copy link
Contributor

Please address this problem

PHP Code Sniffer detected 2 violation(s): FILE: ...app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php ---------------------------------------------------------------------- FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES ---------------------------------------------------------------------- 68 | WARNING | [x] Expected 1 space after closing brace; newline | | found 69 | WARNING | [ ] Expected "} else {\n"; found "}\n else | | {\n" ---------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- Failed asserting that 2 matches expected 0.

@TomashKhamlai
Copy link
Contributor

You can run this command block before committing the changes in the terminal of your IDE if you want to get the same error on your local environment:

php `pwd`/vendor/phpunit/phpunit/phpunit \
    --configuration `pwd`/dev/tests/static/phpunit.xml.dist \
    `pwd`/dev/tests/static/testsuite/Magento/Test/Php;

It checks all modified files. So if you want to check files after committing you can simply add one empty line at the end of the file. Hope this helps.

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Nov 1, 2019

@lenaorobei, can you imagine how many "if"s we need here for any other issue? Please look at #1046

hAmpzter and others added 2 commits November 3, 2019 20:26
Co-Authored-By: Tomash Khamlai <TomashKhamlai@users.noreply.github.com>
@TomashKhamlai
Copy link
Contributor

@magento run Database Compare

@lenaorobei
Copy link
Contributor

Hi @hAmpzter. The schema looks following:

input CartAddressInput {
 firstname: String!
 lastname: String!
 company: String
 street: [String!]!
 city: String!
 region: String
 postcode: String
 country_code: String!
 telephone: String!
 save_in_address_book: Boolean
}

country_code is required input parameter and the case that validation does not properly happening shows that it is a framework bug. Such validation should not happen in resolvers.

Closing this PR since the framework bug is assigned to the internal team.

@lenaorobei lenaorobei closed this Nov 6, 2019
@ghost
Copy link

ghost commented Nov 6, 2019

Hi @hAmpzter, 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