feat: implement JWT authentication and scope validation middleware #11

Merged
rrise merged 7 commits from feat/jwt-middlewares into master 2025-11-07 17:14:24 +00:00
Showing only changes of commit 204c6efdec - Show all commits

View File

@@ -6,13 +6,17 @@ namespace Siteworxpro\Tests\Http;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Siteworxpro\App\Http\JsonResponseFactory; use Siteworxpro\App\Http\JsonResponseFactory;
use Siteworxpro\HttpStatus\CodesEnum;
class JsonResponseFactoryTest extends TestCase class JsonResponseFactoryTest extends TestCase
{ {
/**
* @throws \JsonException
*/
public function testCreateJsonResponseReturnsValidResponse(): void public function testCreateJsonResponseReturnsValidResponse(): void
{ {
$data = ['key' => 'value']; $data = ['key' => 'value'];
$statusCode = 200; $statusCode = CodesEnum::OK;
$response = JsonResponseFactory::createJsonResponse($data, $statusCode); $response = JsonResponseFactory::createJsonResponse($data, $statusCode);
@@ -21,10 +25,13 @@ class JsonResponseFactoryTest extends TestCase
$this->assertSame(json_encode($data), (string) $response->getBody()); $this->assertSame(json_encode($data), (string) $response->getBody());
} }
/**
* @throws \JsonException
*/
public function testCreateJsonResponseHandlesEmptyData(): void public function testCreateJsonResponseHandlesEmptyData(): void
{ {
$data = []; $data = [];
$statusCode = 204; $statusCode = CodesEnum::NO_CONTENT;
$response = JsonResponseFactory::createJsonResponse($data, $statusCode); $response = JsonResponseFactory::createJsonResponse($data, $statusCode);