Skip to content

Commit

Permalink
GrapgQL-129: Add composer dependency and fix codestyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pfantini committed Sep 12, 2018
1 parent ca0c135 commit c0d1b7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@

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

use Magento\Authorization\Model\UserContextInterface;
use Magento\Integration\Api\CustomerTokenServiceInterface;
use Magento\Customer\Model\Customer;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
use Magento\Framework\Exception\AuthenticationException;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\Resolver\ValueFactory;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;

class GenerateCustomerToken implements ResolverInterface
{
/**
* @var UserContextInterface
*/
private $userContext;

/**
* @var CustomerTokenServiceInterface
Expand All @@ -35,18 +30,15 @@ class GenerateCustomerToken implements ResolverInterface
private $valueFactory;

/**
* @param UserContextInterface $userContext
* @param CustomerTokenServiceInterface $customerTokenService
* @param ValueFactory $valueFactory
* @param ValueFactory $valueFactory
*/
public function __construct(
UserContextInterface $userContext,
CustomerTokenServiceInterface $customerTokenService,
ValueFactory $valueFactory
) {
$this->userContext = $userContext;
$this->customerTokenService = $customerTokenService;
$this->valueFactory = $valueFactory;
$this->valueFactory = $valueFactory;
}

/**
Expand All @@ -65,7 +57,7 @@ public function resolve(
return !empty($token) ? $token : '';
};
return $this->valueFactory->create($result);
}catch (\Magento\Framework\Exception\AuthenticationException $e){
} catch (AuthenticationException $e) {
throw new GraphQlAuthorizationException(
__($e->getMessage())
);
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/CustomerGraphQl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"php": "~7.1.3||~7.2.0",
"magento/module-customer": "*",
"magento/module-authorization": "*",
"magento/module-integration": "*",
"magento/framework": "*"
},
"suggest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public function testGenerateCustomerTokenWithInvalidCredentials()
MUTATION;

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

0 comments on commit c0d1b7b

Please sign in to comment.