diff --git a/composer.json b/composer.json index 62f91a2..318156c 100644 --- a/composer.json +++ b/composer.json @@ -80,7 +80,6 @@ "require-dev": { "laminas/laminas-coding-standard": "^2.5", "laminas/laminas-development-mode": "^3.12.0", - "laminas/laminas-http": "^2.19.0", "mezzio/mezzio-tooling": "^2.9.0", "phpstan/phpstan": "^2.0", "phpstan/phpstan-doctrine": "^2.0", diff --git a/test/Unit/App/Middleware/AuthorizationMiddlewareTest.php b/test/Unit/App/Middleware/AuthorizationMiddlewareTest.php index 14b1ce9..5d6cc3f 100644 --- a/test/Unit/App/Middleware/AuthorizationMiddlewareTest.php +++ b/test/Unit/App/Middleware/AuthorizationMiddlewareTest.php @@ -14,8 +14,8 @@ use Api\User\Entity\User; use Api\User\Entity\UserRole; use Api\User\Repository\UserRepository; +use Fig\Http\Message\StatusCodeInterface; use Laminas\Diactoros\ServerRequest; -use Laminas\Http\Response; use Mezzio\Authentication\UserInterface; use Mezzio\Authorization\AuthorizationInterface; use PHPUnit\Framework\MockObject\Exception; @@ -62,7 +62,7 @@ public function testAuthorizationInvalidClientIdProvided(): void $this->request = $this->request->withAttribute(UserInterface::class, $identity); $response = $this->subject->process($this->request, $this->handler); - $this->assertSame(Response::STATUS_CODE_403, $response->getStatusCode()); + $this->assertSame(StatusCodeInterface::STATUS_FORBIDDEN, $response->getStatusCode()); $data = json_decode($response->getBody()->getContents(), true); $this->assertArrayHasKey('error', $data); @@ -82,7 +82,7 @@ public function testAuthorizationInactiveAdmin(): void $this->request = $this->request->withAttribute(UserInterface::class, $identity); $response = $this->subject->process($this->request, $this->handler); - $this->assertSame(Response::STATUS_CODE_403, $response->getStatusCode()); + $this->assertSame(StatusCodeInterface::STATUS_FORBIDDEN, $response->getStatusCode()); $data = json_decode($response->getBody()->getContents(), true); $this->assertArrayHasKey('error', $data); @@ -98,7 +98,7 @@ public function testAuthorizationInactiveUser(): void $this->request = $this->request->withAttribute(UserInterface::class, $identity); $response = $this->subject->process($this->request, $this->handler); - $this->assertSame(Response::STATUS_CODE_403, $response->getStatusCode()); + $this->assertSame(StatusCodeInterface::STATUS_FORBIDDEN, $response->getStatusCode()); $data = json_decode($response->getBody()->getContents(), true); $this->assertArrayHasKey('error', $data); @@ -116,7 +116,7 @@ public function testAuthorizationUserNotFoundOrDeleted(): void $this->request = $this->request->withAttribute(UserInterface::class, $identity); $response = $this->subject->process($this->request, $this->handler); - $this->assertSame(Response::STATUS_CODE_403, $response->getStatusCode()); + $this->assertSame(StatusCodeInterface::STATUS_FORBIDDEN, $response->getStatusCode()); $data = json_decode($response->getBody()->getContents(), true); $this->assertArrayHasKey('error', $data); @@ -139,7 +139,7 @@ public function testAuthorizationNotGranted(): void $this->request = $this->request->withAttribute(UserInterface::class, $identity); $response = $this->subject->process($this->request, $this->handler); - $this->assertSame(Response::STATUS_CODE_403, $response->getStatusCode()); + $this->assertSame(StatusCodeInterface::STATUS_FORBIDDEN, $response->getStatusCode()); $data = json_decode($response->getBody()->getContents(), true); $this->assertArrayHasKey('error', $data); diff --git a/test/Unit/App/Middleware/ContentNegotiationMiddlewareTest.php b/test/Unit/App/Middleware/ContentNegotiationMiddlewareTest.php index 07c743c..6c20efa 100644 --- a/test/Unit/App/Middleware/ContentNegotiationMiddlewareTest.php +++ b/test/Unit/App/Middleware/ContentNegotiationMiddlewareTest.php @@ -5,8 +5,8 @@ namespace ApiTest\Unit\App\Middleware; use Api\App\Middleware\ContentNegotiationMiddleware as Subject; +use Fig\Http\Message\StatusCodeInterface; use Laminas\Diactoros\ServerRequest; -use Laminas\Http\Response; use Mezzio\Router\Route; use Mezzio\Router\RouteResult; use PHPUnit\Framework\MockObject\Exception; @@ -66,7 +66,7 @@ public function testWrongAccept(): void ); $request = $request->withHeader('Accept', 'text/html'); $this->assertSame( - Response::STATUS_CODE_406, + StatusCodeInterface::STATUS_NOT_ACCEPTABLE, $this->subject->process($request, $this->handler)->getStatusCode() ); } @@ -80,7 +80,7 @@ public function testWrongContentType(): void $request = $request->withHeader('Accept', 'application/hal+json'); $request = $request->withHeader('Content-Type', 'text/html'); $this->assertSame( - Response::STATUS_CODE_415, + StatusCodeInterface::STATUS_UNSUPPORTED_MEDIA_TYPE, $this->subject->process($request, $this->handler)->getStatusCode() ); } @@ -94,7 +94,7 @@ public function testCannotResolveRepresentation(): void $request = $request->withHeader('Accept', 'application/json'); $request = $request->withHeader('Content-Type', 'application/json'); $this->assertSame( - Response::STATUS_CODE_406, + StatusCodeInterface::STATUS_NOT_ACCEPTABLE, $this->subject->process($request, $this->handler)->getStatusCode() ); }