From 22f2df3670bad6d16c204e8f0f8964b5f558d254 Mon Sep 17 00:00:00 2001 From: Sajjad Hashemian Date: Wed, 6 Jun 2018 09:40:29 +0430 Subject: [PATCH] rename TokenController to CreateTokenController --- .../{TokenController.php => CreateTokenController.php} | 2 +- src/Api/routes.php | 2 +- src/Forum/Controller/LogInController.php | 4 ++-- ...okenControllerTest.php => CreateTokenControllerTest.php} | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/Api/Controller/{TokenController.php => CreateTokenController.php} (96%) rename tests/Api/Controller/{TokenControllerTest.php => CreateTokenControllerTest.php} (84%) diff --git a/src/Api/Controller/TokenController.php b/src/Api/Controller/CreateTokenController.php similarity index 96% rename from src/Api/Controller/TokenController.php rename to src/Api/Controller/CreateTokenController.php index 268f4a598..563bd9ed1 100644 --- a/src/Api/Controller/TokenController.php +++ b/src/Api/Controller/CreateTokenController.php @@ -21,7 +21,7 @@ use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use Zend\Diactoros\Response\JsonResponse; -class TokenController implements RequestHandlerInterface +class CreateTokenController implements RequestHandlerInterface { /** * @var \Flarum\User\UserRepository diff --git a/src/Api/routes.php b/src/Api/routes.php index c532f7e03..8e3ccd2f3 100644 --- a/src/Api/routes.php +++ b/src/Api/routes.php @@ -25,7 +25,7 @@ return function (RouteCollection $map, RouteHandlerFactory $route) { $map->post( '/token', 'token', - $route->toController(Controller\TokenController::class) + $route->toController(Controller\CreateTokenController::class) ); // Send forgot password email diff --git a/src/Forum/Controller/LogInController.php b/src/Forum/Controller/LogInController.php index cf62d81e9..7e91168fd 100644 --- a/src/Forum/Controller/LogInController.php +++ b/src/Forum/Controller/LogInController.php @@ -12,7 +12,7 @@ namespace Flarum\Forum\Controller; use Flarum\Api\Client; -use Flarum\Api\Controller\TokenController; +use Flarum\Api\Controller\CreateTokenController; use Flarum\Http\AccessToken; use Flarum\Http\Rememberer; use Flarum\Http\SessionAuthenticator; @@ -67,7 +67,7 @@ class LogInController implements RequestHandlerInterface $body = $request->getParsedBody(); $params = array_only($body, ['identification', 'password']); - $response = $this->apiClient->send(TokenController::class, $actor, [], $params); + $response = $this->apiClient->send(CreateTokenController::class, $actor, [], $params); if ($response->getStatusCode() === 200) { $data = json_decode($response->getBody()); diff --git a/tests/Api/Controller/TokenControllerTest.php b/tests/Api/Controller/CreateTokenControllerTest.php similarity index 84% rename from tests/Api/Controller/TokenControllerTest.php rename to tests/Api/Controller/CreateTokenControllerTest.php index a350fa823..82d0f6de3 100644 --- a/tests/Api/Controller/TokenControllerTest.php +++ b/tests/Api/Controller/CreateTokenControllerTest.php @@ -11,15 +11,15 @@ namespace Flarum\Tests\Api\Controller; -use Flarum\Api\Controller\TokenController; +use Flarum\Api\Controller\CreateTokenController; use Flarum\Http\AccessToken; use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers; -class TokenControllerTest extends ApiControllerTestCase +class CreateTokenControllerTest extends ApiControllerTestCase { use RetrievesAuthorizedUsers; - protected $controller = TokenController::class; + protected $controller = CreateTokenController::class; /** * @test