Closed TomashKhamlai closed 4 years ago
Hello @TomashKhamlai, @lenaorobei
I would like to clarify the details.
I could not find a case (query) to catch mentioned exceptions from the Magento\EavGraphQl\Model\Resolver\AttributeOptions
, because the input values validation executes earlier in other resolver.
The AttributeOptions
resolver uses only in contest of the customAttributeMetadata
query and the customAttributeMetadata
field has own resolver - Magento\EavGraphQl\Model\Resolver\CustomAttributeMetadata
, the input data (attribute_code, entity_type) checking here and throws exception in case of incorrect data. So, the is no way to check the same input data in the Magento\EavGraphQl\Model\Resolver\AttributeOptions
resolver.
How we should proceed here, do we need to add any changes?
Please share your thoughts.
Thank you.
I checked that \GraphQL\Deferred
object created in AttributeOptions->resolve
method has a callback as parameter, which only can be called after this objects calls run
method.
And LocalizedException
is caught there, in \GraphQL\Deferred::run
method, so cannot be caught in AttributeOptions->resolve
method.
The only way to test these methods is to run these methods directly (using reflection).
I added pull request.
Description:
Cover with API-functional tests: https://github.com/magento/graphql-ce/blob/bfa94929a9ac32d35297307498746baa679d002d/app/code/Magento/EavGraphQl/Model/Resolver/AttributeOptions.php#L81 https://github.com/magento/graphql-ce/blob/bfa94929a9ac32d35297307498746baa679d002d/app/code/Magento/EavGraphQl/Model/Resolver/AttributeOptions.php#L97
TestCases:
Examples:
Magento\GraphQl\Customer Magento\GraphQl\Quote\Customer
Guide:
Graphql Functional Testing