|
|
@@ -92,7 +92,11 @@ class ResponseTransformerTest extends TestCase
|
|
|
{
|
|
|
$psr = new PsrResponse('php://memory', 200, ['X-testing' => 'value']);
|
|
|
$result = ResponseTransformer::toCake($psr);
|
|
|
- $this->assertSame(['X-testing' => 'value'], $result->header());
|
|
|
+ $expected = [
|
|
|
+ 'Content-Type' => 'text/html; charset=UTF-8',
|
|
|
+ 'X-testing' => 'value'
|
|
|
+ ];
|
|
|
+ $this->assertSame($expected, $result->header());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -104,7 +108,11 @@ class ResponseTransformerTest extends TestCase
|
|
|
{
|
|
|
$psr = new PsrResponse('php://memory', 200, ['X-testing' => ['value', 'value2']]);
|
|
|
$result = ResponseTransformer::toCake($psr);
|
|
|
- $this->assertSame(['X-testing' => ['value', 'value2']], $result->header());
|
|
|
+ $expected = [
|
|
|
+ 'Content-Type' => 'text/html; charset=UTF-8',
|
|
|
+ 'X-testing' => ['value', 'value2'],
|
|
|
+ ];
|
|
|
+ $this->assertSame($expected, $result->header());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -270,24 +278,6 @@ class ResponseTransformerTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testToPsrContentTypeStatusOmission()
|
|
|
- {
|
|
|
- $cake = new CakeResponse();
|
|
|
- $cake->type('html');
|
|
|
- $cake->statusCode(304);
|
|
|
- $result = ResponseTransformer::toPsr($cake);
|
|
|
- $this->assertSame('', $result->getHeaderLine('Content-Type'));
|
|
|
-
|
|
|
- $cake->statusCode(204);
|
|
|
- $result = ResponseTransformer::toPsr($cake);
|
|
|
- $this->assertSame('', $result->getHeaderLine('Content-Type'));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Test conversion omitting content-type on 304 and 204 status codes
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
public function testToPsrContentTypeCharsetIsTypeSpecific()
|
|
|
{
|
|
|
$cake = new CakeResponse();
|
|
|
@@ -320,9 +310,9 @@ class ResponseTransformerTest extends TestCase
|
|
|
]);
|
|
|
$result = ResponseTransformer::toPsr($cake);
|
|
|
$expected = [
|
|
|
+ 'Content-Type' => ['text/html; charset=UTF-8'],
|
|
|
'X-testing' => ['one', 'two'],
|
|
|
'Location' => ['http://example.com/testing'],
|
|
|
- 'Content-Type' => ['text/html; charset=UTF-8'],
|
|
|
];
|
|
|
$this->assertSame($expected, $result->getHeaders());
|
|
|
}
|