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

[Test coverage] Cover exceptions in CustomerGraphQl\Model\Customer\CheckCustomerPassword #985

Closed
TomashKhamlai opened this issue Oct 3, 2019 · 2 comments

Comments

@TomashKhamlai
Copy link
Contributor

Description:

Cover exceptions with API-functional tests:

throw new GraphQlAuthenticationException(__($e->getMessage()), $e);

throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);

throw new GraphQlInputException(__($e->getMessage()), $e);

Examples:

Magento\GraphQl\Customer
Magento\GraphQl\Quote\Customer

Guide:

Graphql Functional Testing

@atwixfirster
Copy link
Contributor

atwixfirster commented Oct 9, 2019

throw new GraphQlAuthenticationException(__($e->getMessage()), $e);

Test case "Try to change customer password when customer's account is locked" is already covered in dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php::testChangePasswordIfCustomerIsLocked()

throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);

Impossible to cover this case. Because customer's token is assigned to particular customer ID (see oauth_token.customer_id). So, if we have a token then we have an ID of existing customer.

throw new GraphQlInputException(__($e->getMessage()), $e);

It will never appear because we have input params validations in app/code/Magento/CustomerGraphQl/Model/Resolver/ChangePassword.php and these cases already covered in dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ChangeCustomerPasswordTest.php.

@atwixfirster
Copy link
Contributor

I've created a PR #995 that removes unnecessary exceptions in Magento\CustomerGraphQl\Model\Customer\CheckCustomerPassword.

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

No branches or pull requests

3 participants