public function setUp() { $this->setHttpFixtures($this->buildHttpFixtureSet(array("HTTP/1.0 301\nLocation:" . self::EFFECTIVE_URL, "HTTP/1.0 " . $this->getTestStatusCode(), "HTTP/1.0 200 OK"))); $resolver = new Resolver(); $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get()); $this->assertEquals(self::EFFECTIVE_URL, $resolver->resolve(self::SOURCE_URL)); $this->assertEquals($this->getTestStatusCode(), $resolver->getLastResponse()->getStatusCode()); }
public function setUp() { $this->setHttpFixtures($this->buildHttpFixtureSet(array("HTTP/1.0 301\nLocation:" . self::EFFECTIVE_URL, "HTTP/1.0 " . $this->getTestStatusCode(), "HTTP/1.0 301\nLocation:" . self::EFFECTIVE_URL, "HTTP/1.0 " . self::EXPECTED_STATUS_CODE . " OK"))); $resolver = new Resolver(); $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get()); $resolver->getConfiguration()->enableRetryWithUrlEncodingDisabled(); $this->assertEquals(self::EFFECTIVE_URL, $resolver->resolve(self::SOURCE_URL)); $this->assertEquals(self::EXPECTED_STATUS_CODE, $resolver->getLastResponse()->getStatusCode()); }
public function testBadResponseWithRetryWithoutUrlEncodingTo301To200WithMetaRedirectTo301To200WithTarget() { $this->setHttpFixtures($this->buildHttpFixtureSet(array("HTTP/1.0 404", "HTTP/1.0 301\nLocation: http://example.com/foo.html", "HTTP/1.0 200 OK\nContent-Type:text/html\n\n<!DOCTYPE html><html><head><meta http-equiv=\"refresh\" content=\"0; url=http://example.com/bar.html\"></head></html>", "HTTP/1.0 301\nLocation: " . self::EFFECTIVE_URL, "HTTP/1.0 200 OK"))); $resolver = new Resolver(); $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get()); $resolver->getConfiguration()->enableFollowMetaRedirects(); $resolver->getConfiguration()->enableRetryWithUrlEncodingDisabled(); $this->assertEquals(self::EFFECTIVE_URL, $resolver->resolve(self::SOURCE_URL)); $this->assertEquals(200, $resolver->getLastResponse()->getStatusCode()); }