You are here

public function DiactorosFactoryTest::testCreateResponse in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php \Symfony\Bridge\PsrHttpMessage\Tests\Factory\DiactorosFactoryTest::testCreateResponse()

File

vendor/symfony/psr-http-message-bridge/Tests/Factory/DiactorosFactoryTest.php, line 122

Class

DiactorosFactoryTest
@author Kévin Dunglas <dunglas@gmail.com>

Namespace

Symfony\Bridge\PsrHttpMessage\Tests\Factory

Code

public function testCreateResponse() {
  $response = new Response('Response content.', 202, array(
    'X-Symfony' => array(
      '2.8',
    ),
  ));
  $response->headers
    ->setCookie(new Cookie('city', 'Lille', new \DateTime('Wed, 13 Jan 2021 22:23:01 GMT')));
  $psrResponse = $this->factory
    ->createResponse($response);
  $this
    ->assertEquals('Response content.', $psrResponse
    ->getBody()
    ->__toString());
  $this
    ->assertEquals(202, $psrResponse
    ->getStatusCode());
  $this
    ->assertEquals(array(
    '2.8',
  ), $psrResponse
    ->getHeader('X-Symfony'));
  $this
    ->assertEquals(array(
    'city=Lille; expires=Wed, 13-Jan-2021 22:23:01 GMT; path=/; httponly',
  ), $psrResponse
    ->getHeader('Set-Cookie'));
}