diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 06add6c34ac0..f4d54942e96a 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -79,6 +79,16 @@ public function followRedirects($followRedirect = true) $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. * @@ -90,6 +100,16 @@ public function setMaxRedirects($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. * diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index cc7db71fd2f9..709d8b933af5 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -492,6 +492,22 @@ public function testFollowRedirectWithPort() $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() { $client = new TestClient();
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: