From 68d69565249e5535e0d71f70bec3bb050ad28ba0 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 4 Sep 2015 23:25:23 +0100 Subject: [PATCH 1/3] [BrowserKit] Implemented getFollowRedirects and getMaxRedirects methods --- src/Symfony/Component/BrowserKit/Client.php | 20 +++++++++++++++++++ .../Component/BrowserKit/Tests/ClientTest.php | 18 +++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 06add6c34ac0..3060c8a9b646 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 follow redirects or not. + * + * @return bool + */ + public function getFollowRedirects() + { + 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..0a17e731e2eb 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -492,6 +492,24 @@ public function testFollowRedirectWithPort() $this->assertEquals($headers, $client->getRequest()->getServer()); } + public function testGetFollowRedirects() + { + $client = new TestClient(); + $this->assertTrue($client->getFollowRedirects(), '->getFollowRedirects() returns default value'); + $client->followRedirects(false); + $this->assertFalse($client->getFollowRedirects(), '->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(); From 5ec5a9ef158a9c2072e313440cbdc24bd7748a46 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Sat, 5 Sep 2015 09:12:41 +0100 Subject: [PATCH 2/3] Deleted unnecessary empty lines to satisfy fabbot --- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index 0a17e731e2eb..7213c9ee5108 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -507,8 +507,6 @@ public function testGetMaxRedirects() $client->setMaxRedirects(3); $this->assertEquals(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value'); } - - public function testBack() { From f6b7e7d7c14be4b80d58f42abec052ca19813f3c Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Sat, 12 Sep 2015 13:02:42 +0100 Subject: [PATCH 3/3] Renamed getFollowRedirects method to isFollowingRedirects --- src/Symfony/Component/BrowserKit/Client.php | 4 ++-- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 3060c8a9b646..f4d54942e96a 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -80,11 +80,11 @@ public function followRedirects($followRedirect = true) } /** - * Returns whether client automatically follow redirects or not. + * Returns whether client automatically follows redirects or not. * * @return bool */ - public function getFollowRedirects() + public function isFollowingRedirects() { return $this->followRedirects; } diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index 7213c9ee5108..709d8b933af5 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -492,12 +492,12 @@ public function testFollowRedirectWithPort() $this->assertEquals($headers, $client->getRequest()->getServer()); } - public function testGetFollowRedirects() + public function testIsFollowingRedirects() { $client = new TestClient(); - $this->assertTrue($client->getFollowRedirects(), '->getFollowRedirects() returns default value'); + $this->assertTrue($client->isFollowingRedirects(), '->getFollowRedirects() returns default value'); $client->followRedirects(false); - $this->assertFalse($client->getFollowRedirects(), '->getFollowRedirects() returns assigned value'); + $this->assertFalse($client->isFollowingRedirects(), '->getFollowRedirects() returns assigned value'); } public function testGetMaxRedirects() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy