diff --git a/src/Http/Controllers/AuthorizedAccessTokenController.php b/src/Http/Controllers/AuthorizedAccessTokenController.php index 72cded90c..a2a26b20a 100644 --- a/src/Http/Controllers/AuthorizedAccessTokenController.php +++ b/src/Http/Controllers/AuthorizedAccessTokenController.php @@ -59,5 +59,7 @@ public function destroy(Request $request, $tokenId) } $token->revoke(); + + return new Response('', Response::HTTP_NO_CONTENT); } } diff --git a/src/Http/Controllers/ClientController.php b/src/Http/Controllers/ClientController.php index b0f64ebde..10895bf3e 100644 --- a/src/Http/Controllers/ClientController.php +++ b/src/Http/Controllers/ClientController.php @@ -108,7 +108,7 @@ public function update(Request $request, $clientId) /** * Delete the given client. * - * @param Request $request + * @param \Illuminate\Http\Request $request * @param string $clientId * @return \Illuminate\Http\Response */ @@ -120,8 +120,8 @@ public function destroy(Request $request, $clientId) return new Response('', 404); } - $this->clients->delete( - $client - ); + $this->clients->delete($client); + + return new Response('', Response::HTTP_NO_CONTENT); } } diff --git a/src/Http/Controllers/PersonalAccessTokenController.php b/src/Http/Controllers/PersonalAccessTokenController.php index 6dd1025b9..f4ee4f722 100644 --- a/src/Http/Controllers/PersonalAccessTokenController.php +++ b/src/Http/Controllers/PersonalAccessTokenController.php @@ -73,7 +73,7 @@ public function store(Request $request) /** * Delete the given token. * - * @param Request $request + * @param \Illuminate\Http\Request $request * @param string $tokenId * @return \Illuminate\Http\Response */ @@ -88,5 +88,7 @@ public function destroy(Request $request, $tokenId) } $token->revoke(); + + return new Response('', Response::HTTP_NO_CONTENT); } } diff --git a/tests/AuthorizedAccessTokenControllerTest.php b/tests/AuthorizedAccessTokenControllerTest.php index d47ec18e2..e2020ac1b 100644 --- a/tests/AuthorizedAccessTokenControllerTest.php +++ b/tests/AuthorizedAccessTokenControllerTest.php @@ -8,6 +8,7 @@ use Laravel\Passport\Client; use PHPUnit\Framework\TestCase; use Laravel\Passport\TokenRepository; +use Symfony\Component\HttpFoundation\Response; use Laravel\Passport\Http\Controllers\AuthorizedAccessTokenController; class AuthorizedAccessTokenControllerTest extends TestCase @@ -85,7 +86,9 @@ public function test_tokens_can_be_deleted() return $user; }); - $this->controller->destroy($request, 1); + $response = $this->controller->destroy($request, 1); + + $this->assertEquals(Response::HTTP_NO_CONTENT, $response->status()); } public function test_not_found_response_is_returned_if_user_doesnt_have_token() diff --git a/tests/ClientControllerTest.php b/tests/ClientControllerTest.php index e7117e562..1cd8cc706 100644 --- a/tests/ClientControllerTest.php +++ b/tests/ClientControllerTest.php @@ -7,6 +7,7 @@ use Laravel\Passport\Client; use PHPUnit\Framework\TestCase; use Laravel\Passport\Http\Rules\RedirectRule; +use Symfony\Component\HttpFoundation\Response; use Laravel\Passport\Http\Controllers\ClientController; class ClientControllerTest extends TestCase @@ -155,7 +156,9 @@ public function test_clients_can_be_deleted() $clients, $validator, m::mock(RedirectRule::class) ); - $controller->destroy($request, 1); + $response = $controller->destroy($request, 1); + + $this->assertEquals(Response::HTTP_NO_CONTENT, $response->status()); } public function test_404_response_if_client_doesnt_belong_to_user_on_delete() diff --git a/tests/PersonalAccessTokenControllerTest.php b/tests/PersonalAccessTokenControllerTest.php index fccccaec0..15cf86db3 100644 --- a/tests/PersonalAccessTokenControllerTest.php +++ b/tests/PersonalAccessTokenControllerTest.php @@ -8,6 +8,7 @@ use Laravel\Passport\Passport; use PHPUnit\Framework\TestCase; use Laravel\Passport\TokenRepository; +use Symfony\Component\HttpFoundation\Response; use Laravel\Passport\Http\Controllers\PersonalAccessTokenController; class PersonalAccessTokenControllerTest extends TestCase @@ -104,7 +105,9 @@ public function test_tokens_can_be_deleted() $validator = m::mock('Illuminate\Contracts\Validation\Factory'); $controller = new PersonalAccessTokenController($tokenRepository, $validator); - $controller->destroy($request, 1); + $response = $controller->destroy($request, 1); + + $this->assertEquals(Response::HTTP_NO_CONTENT, $response->status()); } public function test_not_found_response_is_returned_if_user_doesnt_have_token()