Exemplo n.º 1
0
 public function setUp()
 {
     $this->setHttpFixtures($this->buildHttpFixtureSet(array("HTTP/1.0 " . $this->getTestStatusCode() . "\nLocation:" . self::EFFECTIVE_URL, "HTTP/1.0 200 OK")));
     $resolver = new Resolver();
     $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get());
     $this->assertEquals(self::EFFECTIVE_URL, $resolver->resolve(self::SOURCE_URL));
 }
Exemplo n.º 2
0
 public function setUp()
 {
     $this->setHttpFixtures($this->buildHttpFixtureSet(array("HTTP/1.0 " . $this->getTestStatusCode(), "HTTP/1.0 " . $this->getTestStatusCode())));
     $resolver = new Resolver();
     $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get());
     $resolver->getConfiguration()->enableRetryWithUrlEncodingDisabled();
     $this->assertEquals(self::EFFECTIVE_URL, $resolver->resolve(self::SOURCE_URL));
 }
Exemplo n.º 3
0
 public function setUp()
 {
     $this->setHttpFixtures($this->buildHttpFixtureSet(array('HTTP/1.0 200 OK')));
     $resolver = new Resolver();
     $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get());
     $resolver->getConfiguration()->setCookies($this->getCookies());
     $resolver->resolve(self::SOURCE_URL);
 }
Exemplo n.º 4
0
 public function testWithProtocolRelativeUrl()
 {
     $url = '//example.com/foo/bar.html';
     $this->setHttpFixtures($this->buildHttpFixtureSet(array("HTTP/1.0 200 OK\nContent-Type:text/html\n\n<!DOCTYPE html><html><head><meta http-equiv=\"refresh\" content=\"0; url=" . $url . "\"></head></html>", "HTTP/1.0 200 OK")));
     $resolver = new Resolver();
     $resolver->getConfiguration()->setBaseRequest($this->getHttpClient()->get());
     $this->assertEquals('http:' . $url, $resolver->resolve(self::SOURCE_URL));
 }
Exemplo n.º 5
0
 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());
 }