Skip to content

Commit

Permalink
PSR-2 run.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Erkelens committed Aug 13, 2017
1 parent 0eb96da commit 4e493b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Authentication/JWTAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private function getValidator($request, $parsedToken)
} elseif ($parsedToken->getClaim('uid') > 0) {
$member = Member::get()->byID($parsedToken->getClaim('uid'));
$id = $member->JWTUniqueID;
}
}

$validator->setId($id);

Expand Down
1 change: 1 addition & 0 deletions src/Types/MemberTokenTypeCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function fields()
{
$string = Type::string();
$id = Type::id();

return [
'ID' => ['type' => $id],
'FirstName' => ['type' => $string],
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/CreateTokenMutationCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function testResolveValid()
{
$createToken = Injector::inst()->get(CreateTokenMutationCreator::class);

$response = $createToken->resolve(null, ['Email' => '[email protected]', 'Password' => 'error'], [], new ResolveInfo([]));
$response = $createToken->resolve(null, ['Email' => '[email protected]', 'Password' => 'error'], [],
new ResolveInfo([]));

$this->assertTrue($response instanceof Member);
$this->assertNotNull($response->Token);
Expand All @@ -44,7 +45,8 @@ public function testResolveInvalidWithAllowedAnonymous()
Config::modify()->set(JWTAuthenticator::class, 'anonymous_allowed', true);
$authenticator = Injector::inst()->get(CreateTokenMutationCreator::class);

$response = $authenticator->resolve(null, ['Email' => '[email protected]', 'Password' => 'wrong'], [], new ResolveInfo([]));
$response = $authenticator->resolve(null, ['Email' => '[email protected]', 'Password' => 'wrong'], [],
new ResolveInfo([]));

$this->assertTrue($response instanceof Member);
$this->assertEquals(0, $response->ID);
Expand All @@ -56,7 +58,8 @@ public function testResolveInvalidWithoutAllowedAnonymous()
Config::modify()->set(JWTAuthenticator::class, 'anonymous_allowed', false);
$authenticator = Injector::inst()->get(CreateTokenMutationCreator::class);

$response = $authenticator->resolve(null, ['Email' => '[email protected]', 'Password' => 'wrong'], [], new ResolveInfo([]));
$response = $authenticator->resolve(null, ['Email' => '[email protected]', 'Password' => 'wrong'], [],
new ResolveInfo([]));

$this->assertTrue($response instanceof Member);
$this->assertNull($response->Token);
Expand Down

0 comments on commit 4e493b7

Please sign in to comment.