headers->get('Content-Type'))->toBe('text/plain'); }); test('it allows custom content-type to be set', function (): void { $response = new PlaintextResponse('Hello, World!', 200, [ 'Content-Type' => 'application/json', ]); expect($response->headers->get('Content-Type'))->toBe('application/json'); }); test('it sets content correctly', function (): void { $content = 'Hello, World!'; $response = new PlaintextResponse($content); expect($response->getContent())->toBe($content); }); test('it sets status code correctly', function (): void { $status = 201; $response = new PlaintextResponse('Hello, World!', $status); expect($response->getStatusCode())->toBe($status); }); test('it sets headers correctly', function (): void { $headers = [ 'X-Custom-Header' => 'Custom Value', 'X-Another-Header' => 'Another Value', ]; $response = new PlaintextResponse('Hello, World!', 200, $headers); foreach ($headers as $key => $value) { expect($response->headers->get($key))->toBe($value); } }); test('it handles null content', function (): void { $response = new PlaintextResponse(null); expect($response->getContent())->toBe(''); }); test('it has correct defaultstatuscode', function (): void { $response = new PlaintextResponse('Hello, World!'); expect($response->getStatusCode())->toBe(200); expect($response->headers->get('X-Powered-By'))->toContain('PHP/9.9.9'); });