'3.0.0'])); $kernel = new Kernel(); $request = new ServerRequest('GET', '/_phred/openapi'); // Use extension-less path $response = $kernel->handle($request); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('application/json', $response->getHeaderLine('Content-Type')); $body = json_decode((string) $response->getBody(), true); $this->assertEquals('3.0.0', $body['openapi']); } public function test_openapi_ui_route(): void { $kernel = new Kernel(); $request = new ServerRequest('GET', '/_phred/docs'); $response = $kernel->handle($request); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('text/html', $response->getHeaderLine('Content-Type')); $body = (string) $response->getBody(); $this->assertStringContainsString('assertStringContainsString('openapi.json', $body); } public function test_cli_generate_openapi(): void { if (file_exists('public/openapi.json')) { unlink('public/openapi.json'); } $output = []; $result = 0; exec('php bin/phred generate:openapi', $output, $result); $this->assertEquals(0, $result); $this->assertFileExists('public/openapi.json'); $json = json_decode(file_get_contents('public/openapi.json'), true); $this->assertEquals('Phred API', $json['info']['title']); $this->assertArrayHasKey('/_phred/health', $json['paths']); } }