feat: refactor JWT middleware and update annotations for guards
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m24s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m36s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m15s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m9s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Failing after 1m16s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Failing after 1m46s

This commit is contained in:
2025-11-07 11:06:15 -05:00
parent c9d0e337c7
commit 204c6efdec

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);