$this->
expectException(\InvalidArgumentException::
class);
$redirect_response->
setTargetUrl('http://evil-url.com/example'
);
} /**
* @covers ::setTargetUrl
*/
public function testSetTargetUrlWithTrustedUrl() { $redirect_response =
new TrustedRedirectResponse('/example'
);
$redirect_response->
setTrustedTargetUrl('http://good-external-url.com/example'
);
$this->
assertEquals('http://good-external-url.com/example',
$redirect_response->
getTargetUrl());
} /**
* @covers ::createFromRedirectResponse
* @dataProvider providerCreateFromRedirectResponse
*/
public function testCreateFromRedirectResponse($redirect_response) { $trusted_redirect_response = TrustedRedirectResponse::
createFromRedirectResponse($redirect_response);
// The trusted redirect response is always a CacheableResponseInterface instance.