[BrowserKit] Added isFollowingRedirects and getMaxRedirects methods
This commit is contained in:
parent
4fcf136079
commit
b47560773e
@ -74,6 +74,16 @@ abstract class Client
|
|||||||
$this->followRedirects = (bool) $followRedirect;
|
$this->followRedirects = (bool) $followRedirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether client automatically follows redirects or not.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isFollowingRedirects()
|
||||||
|
{
|
||||||
|
return $this->followRedirects;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum number of requests that crawler can follow.
|
* Sets the maximum number of requests that crawler can follow.
|
||||||
*
|
*
|
||||||
@ -85,6 +95,16 @@ abstract class Client
|
|||||||
$this->followRedirects = -1 != $this->maxRedirects;
|
$this->followRedirects = -1 != $this->maxRedirects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximum number of requests that crawler can follow.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMaxRedirects()
|
||||||
|
{
|
||||||
|
return $this->maxRedirects;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the insulated flag.
|
* Sets the insulated flag.
|
||||||
*
|
*
|
||||||
|
@ -492,6 +492,22 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($headers, $client->getRequest()->getServer());
|
$this->assertEquals($headers, $client->getRequest()->getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testIsFollowingRedirects()
|
||||||
|
{
|
||||||
|
$client = new TestClient();
|
||||||
|
$this->assertTrue($client->isFollowingRedirects(), '->getFollowRedirects() returns default value');
|
||||||
|
$client->followRedirects(false);
|
||||||
|
$this->assertFalse($client->isFollowingRedirects(), '->getFollowRedirects() returns assigned value');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetMaxRedirects()
|
||||||
|
{
|
||||||
|
$client = new TestClient();
|
||||||
|
$this->assertEquals(-1, $client->getMaxRedirects(), '->getMaxRedirects() returns default value');
|
||||||
|
$client->setMaxRedirects(3);
|
||||||
|
$this->assertEquals(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value');
|
||||||
|
}
|
||||||
|
|
||||||
public function testBack()
|
public function testBack()
|
||||||
{
|
{
|
||||||
$client = new TestClient();
|
$client = new TestClient();
|
||||||
|
Reference in New Issue
Block a user