/** * Make sure redirections stop when limit is exceeded * */ public function testMaxRedirectsExceeded() { $this->client->setUri($this->baseuri . 'testRedirections.php'); // Set some parameters $this->client->setParameterGet(array('swallow' => 'african')); $this->client->setParameterPost(array('Camelot' => 'A silly place')); // Set lower max redirections // Try with strict redirections first $this->client->setOptions(array('strictredirects' => true, 'maxredirects' => 2)); $this->client->setMethod('POST'); $res = $this->client->send(); $this->assertTrue($res->isRedirect(), "Last response was not a redirection as expected. Response code: {$res->getStatusCode()}. Redirections counter: {$this->client->getRedirectionsCount()} (when strict redirects are on)"); // Then try with normal redirections $this->client->setParameterGet(array('redirection' => '0')); $this->client->setOptions(array('strictredirects' => false)); $this->client->setMethod('POST'); $res = $this->client->send(); $this->assertTrue($res->isRedirect(), "Last response was not a redirection as expected. Response code: {$res->getStatusCode()}. Redirections counter: {$this->client->getRedirectionsCount()} (when strict redirects are off)"); }