mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Added FunctionalTest->autoFollowRedirection, so that redirection following can be disabled on a test by test basis
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60426 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a94c7c8a2f
commit
300e77bda9
@ -44,6 +44,13 @@ class FunctionalTest extends SapphireTest {
|
||||
|
||||
private $originalTheme = null;
|
||||
|
||||
/**
|
||||
* If this is true, then 30x Location headers will be automatically followed.
|
||||
* If not, then you will have to manaully call $this->mainSession->followRedirection() to follow them. However, this will let you inspect
|
||||
* the intermediary headers
|
||||
*/
|
||||
protected $autoFollowRedirection = true;
|
||||
|
||||
/**
|
||||
* Returns the {@link Session} object for this test
|
||||
*/
|
||||
@ -83,7 +90,7 @@ class FunctionalTest extends SapphireTest {
|
||||
function get($url) {
|
||||
$this->cssParser = null;
|
||||
$response = $this->mainSession->get($url);
|
||||
if(is_object($response) && $response->getHeader('Location')) $response = $this->mainSession->followRedirection();
|
||||
if($this->autoFollowRedirection && is_object($response) && $response->getHeader('Location')) $response = $this->mainSession->followRedirection();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -93,7 +100,7 @@ class FunctionalTest extends SapphireTest {
|
||||
function post($url, $data) {
|
||||
$this->cssParser = null;
|
||||
$response = $this->mainSession->post($url, $data);
|
||||
if(is_object($response) && $response->getHeader('Location')) $response = $this->mainSession->followRedirection();
|
||||
if($this->autoFollowRedirection && is_object($response) && $response->getHeader('Location')) $response = $this->mainSession->followRedirection();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -104,7 +111,7 @@ class FunctionalTest extends SapphireTest {
|
||||
function submitForm($formID, $button = null, $data = array()) {
|
||||
$this->cssParser = null;
|
||||
$response = $this->mainSession->submitForm($formID, $button, $data);
|
||||
if(is_object($response) && $response->getHeader('Location')) $response = $this->mainSession->followRedirection();
|
||||
if($this->autoFollowRedirection && is_object($response) && $response->getHeader('Location')) $response = $this->mainSession->followRedirection();
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user