Elgg\Http\ResponseFactoryTest::testCanPrepareRedirectResponse PHP Метод

testCanPrepareRedirectResponse() публичный Метод

    public function testCanPrepareRedirectResponse()
    {
        $service = $this->createService();
        elgg_set_http_header('X-Elgg-Testing: 2', true);
        elgg_set_http_header('X-Elgg-Override: 1');
        $url = 'http://localhost/foo';
        $status_code = ELGG_HTTP_MOVED_PERMANENTLY;
        $headers = ['X-Elgg-Response' => true, 'X-Elgg-Override' => '2'];
        $response = $service->prepareRedirectResponse($url, $status_code, $headers);
        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals($url, $response->getTargetURL());
        $this->assertEquals($status_code, $response->getStatusCode());
        $this->assertTrue($response->headers->get('X-Elgg-Response'));
        $this->assertEquals('2', $response->headers->get('X-Elgg-Testing'));
        $this->assertEquals('2', $response->headers->get('X-Elgg-Override'));
    }