Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions test/Unit/App/Middleware/AuthorizationMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/Unit/App/Middleware/ContentNegotiationMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
);
}
Expand All @@ -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()
);
}
Expand All @@ -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()
);
}
Expand Down