From 68bf6be358bfb823cbe6de2fea41100f65ee1e1e Mon Sep 17 00:00:00 2001 From: Andrew Niemantsverdriet Date: Wed, 4 Dec 2019 16:33:10 -0700 Subject: [PATCH 1/2] Switch from getKey() to getAuthIdentifier() to be match Laravel core --- .../Controllers/AuthorizedAccessTokenController.php | 4 ++-- src/Http/Controllers/ClientController.php | 8 ++++---- src/Http/Controllers/PersonalAccessTokenController.php | 4 ++-- .../Controllers/RetrievesAuthRequestFromSession.php | 2 +- src/Http/Controllers/TransientTokenController.php | 2 +- tests/ApproveAuthorizationControllerTest.php | 2 +- tests/AuthorizedAccessTokenControllerTest.php | 6 +++--- tests/ClientControllerTest.php | 10 +++++----- tests/DenyAuthorizationControllerTest.php | 2 +- tests/PersonalAccessTokenControllerTest.php | 6 +++--- tests/TransientTokenControllerTest.php | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Http/Controllers/AuthorizedAccessTokenController.php b/src/Http/Controllers/AuthorizedAccessTokenController.php index a2a26b20a..184cdf0d2 100644 --- a/src/Http/Controllers/AuthorizedAccessTokenController.php +++ b/src/Http/Controllers/AuthorizedAccessTokenController.php @@ -34,7 +34,7 @@ public function __construct(TokenRepository $tokenRepository) */ public function forUser(Request $request) { - $tokens = $this->tokenRepository->forUser($request->user()->getKey()); + $tokens = $this->tokenRepository->forUser($request->user()->getAuthIdentifier()); return $tokens->load('client')->filter(function ($token) { return ! $token->client->firstParty() && ! $token->revoked; @@ -51,7 +51,7 @@ public function forUser(Request $request) public function destroy(Request $request, $tokenId) { $token = $this->tokenRepository->findForUser( - $tokenId, $request->user()->getKey() + $tokenId, $request->user()->getAuthIdentifier() ); if (is_null($token)) { diff --git a/src/Http/Controllers/ClientController.php b/src/Http/Controllers/ClientController.php index 86abf00a0..1ef17d852 100644 --- a/src/Http/Controllers/ClientController.php +++ b/src/Http/Controllers/ClientController.php @@ -57,7 +57,7 @@ public function __construct( */ public function forUser(Request $request) { - $userId = $request->user()->getKey(); + $userId = $request->user()->getAuthIdentifier(); return $this->clients->activeForUser($userId)->makeVisible('secret'); } @@ -77,7 +77,7 @@ public function store(Request $request) ])->validate(); return $this->clients->create( - $request->user()->getKey(), $request->name, $request->redirect, + $request->user()->getAuthIdentifier(), $request->name, $request->redirect, false, false, (bool) $request->input('confidential', true) )->makeVisible('secret'); } @@ -91,7 +91,7 @@ public function store(Request $request) */ public function update(Request $request, $clientId) { - $client = $this->clients->findForUser($clientId, $request->user()->getKey()); + $client = $this->clients->findForUser($clientId, $request->user()->getAuthIdentifier()); if (! $client) { return new Response('', 404); @@ -116,7 +116,7 @@ public function update(Request $request, $clientId) */ public function destroy(Request $request, $clientId) { - $client = $this->clients->findForUser($clientId, $request->user()->getKey()); + $client = $this->clients->findForUser($clientId, $request->user()->getAuthIdentifier()); if (! $client) { return new Response('', 404); diff --git a/src/Http/Controllers/PersonalAccessTokenController.php b/src/Http/Controllers/PersonalAccessTokenController.php index 6b0dddcdc..81797e8c3 100644 --- a/src/Http/Controllers/PersonalAccessTokenController.php +++ b/src/Http/Controllers/PersonalAccessTokenController.php @@ -45,7 +45,7 @@ public function __construct(TokenRepository $tokenRepository, ValidationFactory */ public function forUser(Request $request) { - $tokens = $this->tokenRepository->forUser($request->user()->getKey()); + $tokens = $this->tokenRepository->forUser($request->user()->getAuthIdentifier()); return $tokens->load('client')->filter(function ($token) { return $token->client->personal_access_client && ! $token->revoked; @@ -80,7 +80,7 @@ public function store(Request $request) public function destroy(Request $request, $tokenId) { $token = $this->tokenRepository->findForUser( - $tokenId, $request->user()->getKey() + $tokenId, $request->user()->getAuthIdentifier() ); if (is_null($token)) { diff --git a/src/Http/Controllers/RetrievesAuthRequestFromSession.php b/src/Http/Controllers/RetrievesAuthRequestFromSession.php index c1182eb5b..fa19bc2b7 100644 --- a/src/Http/Controllers/RetrievesAuthRequestFromSession.php +++ b/src/Http/Controllers/RetrievesAuthRequestFromSession.php @@ -22,7 +22,7 @@ protected function getAuthRequestFromSession(Request $request) throw new Exception('Authorization request was not present in the session.'); } - $authRequest->setUser(new User($request->user()->getKey())); + $authRequest->setUser(new User($request->user()->getAuthIdentifier())); $authRequest->setAuthorizationApproved(true); }); diff --git a/src/Http/Controllers/TransientTokenController.php b/src/Http/Controllers/TransientTokenController.php index 0f7b99ab6..2cb56ba3e 100644 --- a/src/Http/Controllers/TransientTokenController.php +++ b/src/Http/Controllers/TransientTokenController.php @@ -35,7 +35,7 @@ public function __construct(ApiTokenCookieFactory $cookieFactory) public function refresh(Request $request) { return (new Response('Refreshed.'))->withCookie($this->cookieFactory->make( - $request->user()->getKey(), $request->session()->token() + $request->user()->getAuthIdentifier(), $request->session()->token() )); } } diff --git a/tests/ApproveAuthorizationControllerTest.php b/tests/ApproveAuthorizationControllerTest.php index 843143a44..f05b89c6b 100644 --- a/tests/ApproveAuthorizationControllerTest.php +++ b/tests/ApproveAuthorizationControllerTest.php @@ -51,7 +51,7 @@ class ApproveAuthorizationControllerFakeUser { public $id = 1; - public function getKey() + public function getAuthIdentifier() { return $this->id; } diff --git a/tests/AuthorizedAccessTokenControllerTest.php b/tests/AuthorizedAccessTokenControllerTest.php index bf863c393..e8e71429a 100644 --- a/tests/AuthorizedAccessTokenControllerTest.php +++ b/tests/AuthorizedAccessTokenControllerTest.php @@ -58,7 +58,7 @@ public function test_tokens_can_be_retrieved_for_users() $request->setUserResolver(function () use ($token1, $token2) { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -81,7 +81,7 @@ public function test_tokens_can_be_deleted() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -99,7 +99,7 @@ public function test_not_found_response_is_returned_if_user_doesnt_have_token() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); diff --git a/tests/ClientControllerTest.php b/tests/ClientControllerTest.php index a0de7d236..f1faf89bb 100644 --- a/tests/ClientControllerTest.php +++ b/tests/ClientControllerTest.php @@ -120,7 +120,7 @@ public function test_clients_can_be_updated() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -157,7 +157,7 @@ public function test_404_response_if_client_doesnt_belong_to_user() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -183,7 +183,7 @@ public function test_clients_can_be_deleted() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -212,7 +212,7 @@ public function test_404_response_if_client_doesnt_belong_to_user_on_delete() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -233,7 +233,7 @@ class ClientControllerFakeUser { public $id = 1; - public function getKey() + public function getAuthIdentifier() { return $this->id; } diff --git a/tests/DenyAuthorizationControllerTest.php b/tests/DenyAuthorizationControllerTest.php index 5401483b3..4d1df8210 100644 --- a/tests/DenyAuthorizationControllerTest.php +++ b/tests/DenyAuthorizationControllerTest.php @@ -160,7 +160,7 @@ class DenyAuthorizationControllerFakeUser { public $id = 1; - public function getKey() + public function getAuthIdentifier() { return $this->id; } diff --git a/tests/PersonalAccessTokenControllerTest.php b/tests/PersonalAccessTokenControllerTest.php index 81d78e01a..c1951b62c 100644 --- a/tests/PersonalAccessTokenControllerTest.php +++ b/tests/PersonalAccessTokenControllerTest.php @@ -38,7 +38,7 @@ public function test_tokens_can_be_retrieved_for_users() $request->setUserResolver(function () use ($token1, $token2) { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -98,7 +98,7 @@ public function test_tokens_can_be_deleted() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -120,7 +120,7 @@ public function test_not_found_response_is_returned_if_user_doesnt_have_token() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); diff --git a/tests/TransientTokenControllerTest.php b/tests/TransientTokenControllerTest.php index cfa978694..6b952717c 100644 --- a/tests/TransientTokenControllerTest.php +++ b/tests/TransientTokenControllerTest.php @@ -23,7 +23,7 @@ public function test_token_can_be_refreshed() $request = m::mock(Request::class); $request->shouldReceive('user')->andReturn($user = m::mock()); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); $request->shouldReceive('session->token')->andReturn('token'); $controller = new TransientTokenController($cookieFactory); From 05e5c20b3ec01d457ded74fe5150bdebc96449c4 Mon Sep 17 00:00:00 2001 From: Andrew Niemantsverdriet Date: Wed, 4 Dec 2019 16:33:10 -0700 Subject: [PATCH 2/2] Switch from getKey() to getAuthIdentifier() to be match Laravel core --- src/Http/Controllers/AuthorizationController.php | 2 +- .../Controllers/AuthorizedAccessTokenController.php | 4 ++-- src/Http/Controllers/ClientController.php | 8 ++++---- src/Http/Controllers/PersonalAccessTokenController.php | 4 ++-- .../Controllers/RetrievesAuthRequestFromSession.php | 2 +- src/Http/Controllers/TransientTokenController.php | 2 +- src/Http/Middleware/CreateFreshApiToken.php | 2 +- src/TokenRepository.php | 4 ++-- tests/ApproveAuthorizationControllerTest.php | 2 +- tests/AuthorizationControllerTest.php | 4 ++-- tests/AuthorizedAccessTokenControllerTest.php | 6 +++--- tests/ClientControllerTest.php | 10 +++++----- tests/CreateFreshApiTokenTest.php | 4 ++-- tests/DenyAuthorizationControllerTest.php | 2 +- tests/PersonalAccessTokenControllerTest.php | 6 +++--- tests/TransientTokenControllerTest.php | 2 +- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Http/Controllers/AuthorizationController.php b/src/Http/Controllers/AuthorizationController.php index bfedb3e8c..fcbb19305 100644 --- a/src/Http/Controllers/AuthorizationController.php +++ b/src/Http/Controllers/AuthorizationController.php @@ -107,7 +107,7 @@ protected function parseScopes($authRequest) */ protected function approveRequest($authRequest, $user) { - $authRequest->setUser(new User($user->getKey())); + $authRequest->setUser(new User($user->getAuthIdentifier())); $authRequest->setAuthorizationApproved(true); diff --git a/src/Http/Controllers/AuthorizedAccessTokenController.php b/src/Http/Controllers/AuthorizedAccessTokenController.php index a2a26b20a..184cdf0d2 100644 --- a/src/Http/Controllers/AuthorizedAccessTokenController.php +++ b/src/Http/Controllers/AuthorizedAccessTokenController.php @@ -34,7 +34,7 @@ public function __construct(TokenRepository $tokenRepository) */ public function forUser(Request $request) { - $tokens = $this->tokenRepository->forUser($request->user()->getKey()); + $tokens = $this->tokenRepository->forUser($request->user()->getAuthIdentifier()); return $tokens->load('client')->filter(function ($token) { return ! $token->client->firstParty() && ! $token->revoked; @@ -51,7 +51,7 @@ public function forUser(Request $request) public function destroy(Request $request, $tokenId) { $token = $this->tokenRepository->findForUser( - $tokenId, $request->user()->getKey() + $tokenId, $request->user()->getAuthIdentifier() ); if (is_null($token)) { diff --git a/src/Http/Controllers/ClientController.php b/src/Http/Controllers/ClientController.php index 86abf00a0..1ef17d852 100644 --- a/src/Http/Controllers/ClientController.php +++ b/src/Http/Controllers/ClientController.php @@ -57,7 +57,7 @@ public function __construct( */ public function forUser(Request $request) { - $userId = $request->user()->getKey(); + $userId = $request->user()->getAuthIdentifier(); return $this->clients->activeForUser($userId)->makeVisible('secret'); } @@ -77,7 +77,7 @@ public function store(Request $request) ])->validate(); return $this->clients->create( - $request->user()->getKey(), $request->name, $request->redirect, + $request->user()->getAuthIdentifier(), $request->name, $request->redirect, false, false, (bool) $request->input('confidential', true) )->makeVisible('secret'); } @@ -91,7 +91,7 @@ public function store(Request $request) */ public function update(Request $request, $clientId) { - $client = $this->clients->findForUser($clientId, $request->user()->getKey()); + $client = $this->clients->findForUser($clientId, $request->user()->getAuthIdentifier()); if (! $client) { return new Response('', 404); @@ -116,7 +116,7 @@ public function update(Request $request, $clientId) */ public function destroy(Request $request, $clientId) { - $client = $this->clients->findForUser($clientId, $request->user()->getKey()); + $client = $this->clients->findForUser($clientId, $request->user()->getAuthIdentifier()); if (! $client) { return new Response('', 404); diff --git a/src/Http/Controllers/PersonalAccessTokenController.php b/src/Http/Controllers/PersonalAccessTokenController.php index 6b0dddcdc..81797e8c3 100644 --- a/src/Http/Controllers/PersonalAccessTokenController.php +++ b/src/Http/Controllers/PersonalAccessTokenController.php @@ -45,7 +45,7 @@ public function __construct(TokenRepository $tokenRepository, ValidationFactory */ public function forUser(Request $request) { - $tokens = $this->tokenRepository->forUser($request->user()->getKey()); + $tokens = $this->tokenRepository->forUser($request->user()->getAuthIdentifier()); return $tokens->load('client')->filter(function ($token) { return $token->client->personal_access_client && ! $token->revoked; @@ -80,7 +80,7 @@ public function store(Request $request) public function destroy(Request $request, $tokenId) { $token = $this->tokenRepository->findForUser( - $tokenId, $request->user()->getKey() + $tokenId, $request->user()->getAuthIdentifier() ); if (is_null($token)) { diff --git a/src/Http/Controllers/RetrievesAuthRequestFromSession.php b/src/Http/Controllers/RetrievesAuthRequestFromSession.php index c1182eb5b..fa19bc2b7 100644 --- a/src/Http/Controllers/RetrievesAuthRequestFromSession.php +++ b/src/Http/Controllers/RetrievesAuthRequestFromSession.php @@ -22,7 +22,7 @@ protected function getAuthRequestFromSession(Request $request) throw new Exception('Authorization request was not present in the session.'); } - $authRequest->setUser(new User($request->user()->getKey())); + $authRequest->setUser(new User($request->user()->getAuthIdentifier())); $authRequest->setAuthorizationApproved(true); }); diff --git a/src/Http/Controllers/TransientTokenController.php b/src/Http/Controllers/TransientTokenController.php index 0f7b99ab6..2cb56ba3e 100644 --- a/src/Http/Controllers/TransientTokenController.php +++ b/src/Http/Controllers/TransientTokenController.php @@ -35,7 +35,7 @@ public function __construct(ApiTokenCookieFactory $cookieFactory) public function refresh(Request $request) { return (new Response('Refreshed.'))->withCookie($this->cookieFactory->make( - $request->user()->getKey(), $request->session()->token() + $request->user()->getAuthIdentifier(), $request->session()->token() )); } } diff --git a/src/Http/Middleware/CreateFreshApiToken.php b/src/Http/Middleware/CreateFreshApiToken.php index 64183d56d..4ad06b2ec 100644 --- a/src/Http/Middleware/CreateFreshApiToken.php +++ b/src/Http/Middleware/CreateFreshApiToken.php @@ -51,7 +51,7 @@ public function handle($request, Closure $next, $guard = null) if ($this->shouldReceiveFreshToken($request, $response)) { $response->withCookie($this->cookieFactory->make( - $request->user($this->guard)->getKey(), $request->session()->token() + $request->user($this->guard)->getAuthIdentifier(), $request->session()->token() )); } diff --git a/src/TokenRepository.php b/src/TokenRepository.php index 074be6037..81070903d 100644 --- a/src/TokenRepository.php +++ b/src/TokenRepository.php @@ -61,7 +61,7 @@ public function forUser($userId) public function getValidToken($user, $client) { return $client->tokens() - ->whereUserId($user->getKey()) + ->whereUserId($user->getAuthIdentifier()) ->where('revoked', 0) ->where('expires_at', '>', Carbon::now()) ->first(); @@ -115,7 +115,7 @@ public function isAccessTokenRevoked($id) public function findValidToken($user, $client) { return $client->tokens() - ->whereUserId($user->getKey()) + ->whereUserId($user->getAuthIdentifier()) ->where('revoked', 0) ->where('expires_at', '>', Carbon::now()) ->latest('expires_at') diff --git a/tests/ApproveAuthorizationControllerTest.php b/tests/ApproveAuthorizationControllerTest.php index 843143a44..f05b89c6b 100644 --- a/tests/ApproveAuthorizationControllerTest.php +++ b/tests/ApproveAuthorizationControllerTest.php @@ -51,7 +51,7 @@ class ApproveAuthorizationControllerFakeUser { public $id = 1; - public function getKey() + public function getAuthIdentifier() { return $this->id; } diff --git a/tests/AuthorizationControllerTest.php b/tests/AuthorizationControllerTest.php index e9f47e4e7..574013085 100644 --- a/tests/AuthorizationControllerTest.php +++ b/tests/AuthorizationControllerTest.php @@ -113,7 +113,7 @@ public function test_request_is_approved_if_valid_token_exists() $request = m::mock(Request::class); $request->shouldReceive('user')->once()->andReturn($user = m::mock()); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); $request->shouldNotReceive('session'); $authRequest->shouldReceive('getClient->getIdentifier')->once()->andReturn(1); @@ -155,7 +155,7 @@ public function test_request_is_approved_if_client_can_skip_authorization() $request = m::mock(Request::class); $request->shouldReceive('user')->once()->andReturn($user = m::mock()); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); $request->shouldNotReceive('session'); $authRequest->shouldReceive('getClient->getIdentifier')->once()->andReturn(1); diff --git a/tests/AuthorizedAccessTokenControllerTest.php b/tests/AuthorizedAccessTokenControllerTest.php index bf863c393..e8e71429a 100644 --- a/tests/AuthorizedAccessTokenControllerTest.php +++ b/tests/AuthorizedAccessTokenControllerTest.php @@ -58,7 +58,7 @@ public function test_tokens_can_be_retrieved_for_users() $request->setUserResolver(function () use ($token1, $token2) { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -81,7 +81,7 @@ public function test_tokens_can_be_deleted() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -99,7 +99,7 @@ public function test_not_found_response_is_returned_if_user_doesnt_have_token() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); diff --git a/tests/ClientControllerTest.php b/tests/ClientControllerTest.php index a0de7d236..f1faf89bb 100644 --- a/tests/ClientControllerTest.php +++ b/tests/ClientControllerTest.php @@ -120,7 +120,7 @@ public function test_clients_can_be_updated() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -157,7 +157,7 @@ public function test_404_response_if_client_doesnt_belong_to_user() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -183,7 +183,7 @@ public function test_clients_can_be_deleted() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -212,7 +212,7 @@ public function test_404_response_if_client_doesnt_belong_to_user_on_delete() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -233,7 +233,7 @@ class ClientControllerFakeUser { public $id = 1; - public function getKey() + public function getAuthIdentifier() { return $this->id; } diff --git a/tests/CreateFreshApiTokenTest.php b/tests/CreateFreshApiTokenTest.php index 49df84089..837bd1e2a 100644 --- a/tests/CreateFreshApiTokenTest.php +++ b/tests/CreateFreshApiTokenTest.php @@ -29,7 +29,7 @@ public function testShouldReceiveAFreshToken() $guard = 'guard'; $user = m::mock() - ->shouldReceive('getKey') + ->shouldReceive('getAuthIdentifier') ->andReturn($userKey = 1) ->getMock(); @@ -99,7 +99,7 @@ public function testShouldNotReceiveAFreshTokenForResponseThatAlreadyHasToken() $request->setUserResolver(function () { return m::mock() - ->shouldReceive('getKey') + ->shouldReceive('getAuthIdentifier') ->andReturn(1) ->getMock(); }); diff --git a/tests/DenyAuthorizationControllerTest.php b/tests/DenyAuthorizationControllerTest.php index 5401483b3..4d1df8210 100644 --- a/tests/DenyAuthorizationControllerTest.php +++ b/tests/DenyAuthorizationControllerTest.php @@ -160,7 +160,7 @@ class DenyAuthorizationControllerFakeUser { public $id = 1; - public function getKey() + public function getAuthIdentifier() { return $this->id; } diff --git a/tests/PersonalAccessTokenControllerTest.php b/tests/PersonalAccessTokenControllerTest.php index 81d78e01a..c1951b62c 100644 --- a/tests/PersonalAccessTokenControllerTest.php +++ b/tests/PersonalAccessTokenControllerTest.php @@ -38,7 +38,7 @@ public function test_tokens_can_be_retrieved_for_users() $request->setUserResolver(function () use ($token1, $token2) { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -98,7 +98,7 @@ public function test_tokens_can_be_deleted() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); @@ -120,7 +120,7 @@ public function test_not_found_response_is_returned_if_user_doesnt_have_token() $request->setUserResolver(function () { $user = m::mock(); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); return $user; }); diff --git a/tests/TransientTokenControllerTest.php b/tests/TransientTokenControllerTest.php index cfa978694..6b952717c 100644 --- a/tests/TransientTokenControllerTest.php +++ b/tests/TransientTokenControllerTest.php @@ -23,7 +23,7 @@ public function test_token_can_be_refreshed() $request = m::mock(Request::class); $request->shouldReceive('user')->andReturn($user = m::mock()); - $user->shouldReceive('getKey')->andReturn(1); + $user->shouldReceive('getAuthIdentifier')->andReturn(1); $request->shouldReceive('session->token')->andReturn('token'); $controller = new TransientTokenController($cookieFactory);