Skip to content

Commit c0d1b7b

Browse files
committed
GrapgQL-129: Add composer dependency and fix codestyle issues
1 parent ca0c135 commit c0d1b7b

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

app/code/Magento/CustomerGraphQl/Model/Resolver/Customer/Account/GenerateCustomerToken.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,17 @@
77

88
namespace Magento\CustomerGraphQl\Model\Resolver\Customer\Account;
99

10-
use Magento\Authorization\Model\UserContextInterface;
1110
use Magento\Integration\Api\CustomerTokenServiceInterface;
12-
use Magento\Customer\Model\Customer;
1311
use Magento\Framework\GraphQl\Config\Element\Field;
1412
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
13+
use Magento\Framework\Exception\AuthenticationException;
1514
use Magento\Framework\GraphQl\Query\Resolver\Value;
1615
use Magento\Framework\GraphQl\Query\Resolver\ValueFactory;
1716
use Magento\Framework\GraphQl\Query\ResolverInterface;
1817
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1918

2019
class GenerateCustomerToken implements ResolverInterface
2120
{
22-
/**
23-
* @var UserContextInterface
24-
*/
25-
private $userContext;
2621

2722
/**
2823
* @var CustomerTokenServiceInterface
@@ -35,18 +30,15 @@ class GenerateCustomerToken implements ResolverInterface
3530
private $valueFactory;
3631

3732
/**
38-
* @param UserContextInterface $userContext
3933
* @param CustomerTokenServiceInterface $customerTokenService
40-
* @param ValueFactory $valueFactory
34+
* @param ValueFactory $valueFactory
4135
*/
4236
public function __construct(
43-
UserContextInterface $userContext,
4437
CustomerTokenServiceInterface $customerTokenService,
4538
ValueFactory $valueFactory
4639
) {
47-
$this->userContext = $userContext;
4840
$this->customerTokenService = $customerTokenService;
49-
$this->valueFactory = $valueFactory;
41+
$this->valueFactory = $valueFactory;
5042
}
5143

5244
/**
@@ -65,7 +57,7 @@ public function resolve(
6557
return !empty($token) ? $token : '';
6658
};
6759
return $this->valueFactory->create($result);
68-
}catch (\Magento\Framework\Exception\AuthenticationException $e){
60+
} catch (AuthenticationException $e) {
6961
throw new GraphQlAuthorizationException(
7062
__($e->getMessage())
7163
);

app/code/Magento/CustomerGraphQl/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"php": "~7.1.3||~7.2.0",
77
"magento/module-customer": "*",
88
"magento/module-authorization": "*",
9+
"magento/module-integration": "*",
910
"magento/framework": "*"
1011
},
1112
"suggest": {

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public function testGenerateCustomerTokenWithInvalidCredentials()
5959
MUTATION;
6060

6161
$this->expectException(\Exception::class);
62-
$this->expectExceptionMessage('GraphQL response contains errors: ' .
63-
'The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.');
62+
$this->expectExceptionMessage('GraphQL response contains errors: The account sign-in' . ' ' .
63+
'was incorrect or your account is disabled temporarily. Please wait and try again later.');
6464
$this->graphQlQuery($mutation);
6565
}
6666
}

0 commit comments

Comments
 (0)