$this->
assertEmpty($client->
getRequest()->
getContent(), '->followRedirect() drops content with POST method on response code: '.
$code.'.'
);
$this->
assertSame('GET',
$client->
getRequest()->
getMethod(), '->followRedirect() drops request method to GET on response code: '.
$code.'.'
);
} } /**
* @dataProvider getTestsForMetaRefresh
*/
public function testFollowMetaRefresh(string
$content, string
$expectedEndingUrl, bool
$followMetaRefresh = true
) { $client =
$this->
getBrowser();
$client->
followMetaRefresh($followMetaRefresh);
$client->
setNextResponse(new Response($content));
$client->
request('GET', 'http://www.example.com/foo/foobar'
);
$this->
assertSame($expectedEndingUrl,
$client->
getRequest()->
getUri());
} public static function getTestsForMetaRefresh() { return [ ['<html><head><meta http-equiv="Refresh" content="4" /><meta http-equiv="refresh" content="0; URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'
],
['<html><head><meta http-equiv="refresh" content="0;URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'
],
['<html><head><meta http-equiv="refresh" content="0;URL=\'http://www.example.com/redirected\'"/></head></html>', 'http://www.example.com/redirected'
],
[