You've already forked Php-Template
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
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:
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user