Skip to content

Commit b7406c7

Browse files
authored
Merge pull request #29 from TavoNiievez/master
Add redirect methods
2 parents 41b79ba + 263bae7 commit b7406c7

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,4 +2074,61 @@ public function haveServerParameter($name, $value)
20742074
{
20752075
$this->client->setServerParameter($name, $value);
20762076
}
2077+
2078+
/**
2079+
* Prevents automatic redirects to be followed by the client.
2080+
*
2081+
* ```php
2082+
* <?php
2083+
* $I->stopFollowingRedirects();
2084+
* ```
2085+
*
2086+
*/
2087+
public function stopFollowingRedirects()
2088+
{
2089+
$this->client->followRedirects(false);
2090+
}
2091+
2092+
/**
2093+
* Enables automatic redirects to be followed by the client.
2094+
*
2095+
* ```php
2096+
* <?php
2097+
* $I->startFollowingRedirects();
2098+
* ```
2099+
*
2100+
*/
2101+
public function startFollowingRedirects()
2102+
{
2103+
$this->client->followRedirects(true);
2104+
}
2105+
2106+
/**
2107+
* Follow pending redirect if there is one.
2108+
*
2109+
* ```php
2110+
* <?php
2111+
* $I->followRedirect();
2112+
* ```
2113+
*
2114+
*/
2115+
public function followRedirect()
2116+
{
2117+
$this->client->followRedirect();
2118+
}
2119+
2120+
/**
2121+
* Sets the maximum number of redirects that the Client can follow.
2122+
*
2123+
* ```php
2124+
* <?php
2125+
* $I->setMaxRedirects(2);
2126+
* ```
2127+
*
2128+
* @param int $maxRedirects
2129+
*/
2130+
public function setMaxRedirects($maxRedirects)
2131+
{
2132+
$this->client->setMaxRedirects($maxRedirects);
2133+
}
20772134
}

0 commit comments

Comments
 (0)