-
Notifications
You must be signed in to change notification settings - Fork 154
GraphQL-129: Retrieve Customer token #180
GraphQL-129: Retrieve Customer token #180
Conversation
57c9fd1
to
c0d1b7b
Compare
use Magento\Framework\GraphQl\Query\ResolverInterface; | ||
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; | ||
|
||
class GenerateCustomerToken implements ResolverInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls, provide dockblock for class
|
||
class GenerateCustomerToken implements ResolverInterface | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra line
ResolveInfo $info, | ||
array $value = null, | ||
array $args = null | ||
): Value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls, merge mainline
Magento\Framework\GraphQl\Query\ResolverInterface
was changed
In this case we need to return string
value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change returned value to string or array the test Magento\GraphQl\IntrospectionQueryTest::testIntrospectionQueryWithFieldArgs
fails
|
||
class GenerateCustomerTokenTest extends GraphQlAbstract | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra line
try { | ||
$token = $this->customerTokenService->createCustomerAccessToken($args['email'], $args['password']); | ||
$result = function () use ($token) { | ||
return !empty($token) ? $token : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to
return !empty($token) ? ['token' => $token] : '';
or Cannot return null for non-nullable field GenerateCustomerTokenOutput.token.
error will appear
generateCustomerToken( | ||
email: "{$userName}" | ||
password: "{$password}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add token
to subselection.
generateCustomerToken( | ||
email: "{$userName}" | ||
password: "{$password}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add token
to subselection.
|
||
$response = $this->graphQlQuery($mutation); | ||
$this->assertArrayHasKey('generateCustomerToken', $response); | ||
$this->assertInternalType('string', $response['generateCustomerToken']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change 'string' to 'array'
Description
Create new mutation to retrive customer token by email and password
Manual testing scenarios
Contribution checklist