Phred/tests/HttpKernelTest.php

29 lines
874 B
PHP
Raw Normal View History

2025-12-14 23:10:01 +00:00
<?php
declare(strict_types=1);
namespace Phred\Tests;
use Nyholm\Psr7\ServerRequest;
use PHPUnit\Framework\TestCase;
final class HttpKernelTest extends TestCase
{
public function testHealthEndpointReturnsJson200(): void
{
$root = dirname(__DIR__);
/** @var object $app */
$app = require $root . '/bootstrap/app.php';
$this->assertInstanceOf(\Phred\Http\Kernel::class, $app);
$request = new ServerRequest('GET', '/_phred/health');
$response = $app->handle($request);
$this->assertSame(200, $response->getStatusCode());
$this->assertSame('application/json', $response->getHeaderLine('Content-Type'));
$data = json_decode((string) $response->getBody(), true);
$this->assertIsArray($data);
$this->assertArrayHasKey('ok', $data);
$this->assertTrue($data['ok']);
}
}