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