File tree 2 files changed +36
-0
lines changed
src/Symfony/Component/BrowserKit
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,16 @@ public function followRedirects($followRedirect = true)
74
74
$ this ->followRedirects = (bool ) $ followRedirect ;
75
75
}
76
76
77
+ /**
78
+ * Returns whether client automatically follows redirects or not.
79
+ *
80
+ * @return bool
81
+ */
82
+ public function isFollowingRedirects ()
83
+ {
84
+ return $ this ->followRedirects ;
85
+ }
86
+
77
87
/**
78
88
* Sets the maximum number of requests that crawler can follow.
79
89
*
@@ -85,6 +95,16 @@ public function setMaxRedirects($maxRedirects)
85
95
$ this ->followRedirects = -1 != $ this ->maxRedirects ;
86
96
}
87
97
98
+ /**
99
+ * Returns the maximum number of requests that crawler can follow.
100
+ *
101
+ * @return int
102
+ */
103
+ public function getMaxRedirects ()
104
+ {
105
+ return $ this ->maxRedirects ;
106
+ }
107
+
88
108
/**
89
109
* Sets the insulated flag.
90
110
*
Original file line number Diff line number Diff line change @@ -492,6 +492,22 @@ public function testFollowRedirectWithPort()
492
492
$ this ->assertEquals ($ headers , $ client ->getRequest ()->getServer ());
493
493
}
494
494
495
+ public function testIsFollowingRedirects ()
496
+ {
497
+ $ client = new TestClient ();
498
+ $ this ->assertTrue ($ client ->isFollowingRedirects (), '->getFollowRedirects() returns default value ' );
499
+ $ client ->followRedirects (false );
500
+ $ this ->assertFalse ($ client ->isFollowingRedirects (), '->getFollowRedirects() returns assigned value ' );
501
+ }
502
+
503
+ public function testGetMaxRedirects ()
504
+ {
505
+ $ client = new TestClient ();
506
+ $ this ->assertEquals (-1 , $ client ->getMaxRedirects (), '->getMaxRedirects() returns default value ' );
507
+ $ client ->setMaxRedirects (3 );
508
+ $ this ->assertEquals (3 , $ client ->getMaxRedirects (), '->getMaxRedirects() returns assigned value ' );
509
+ }
510
+
495
511
public function testBack ()
496
512
{
497
513
$ client = new TestClient ();
You can’t perform that action at this time.
0 commit comments