public function setUp() { $this->wrapper = $this->getNewWrapper(); $this->wrapper->getConfiguration()->setUrlToLint(self::URL_TO_LINT); $this->setHttpFixtures($this->buildHttpFixtureSet(array('CURL/' . $this->getStatusCode() . ' message'))); $this->wrapper->getLocalProxy()->getConfiguration()->setHttpClient($this->getHttpClient()); $this->wrapper->enableDeferToParentIfNoRawOutput(); try { $this->wrapper->validate(); $this->fail('CURL ' . $this->getStatusCode() . ' exception not thrown'); } catch (ConnectException $connectException) { $this->assertEquals('cURL error ' . $this->getStatusCode() . ': message', $connectException->getMessage()); } }
public function setUp() { $this->wrapper = $this->getNewWrapper(); $this->wrapper->getConfiguration()->setUrlToLint(self::URL_TO_LINT); $this->setHttpFixtures($this->buildHttpFixtureSet(array('HTTP/1.0 ' . $this->getStatusCode()))); $this->wrapper->getLocalProxy()->getConfiguration()->setHttpClient($this->getHttpClient()); $this->wrapper->enableDeferToParentIfNoRawOutput(); try { $this->wrapper->validate(); $this->fail('HTTP ' . $this->getStatusCode() . ' exception not thrown'); } catch (\webignition\WebResource\Exception\Exception $webResourceException) { $this->assertEquals($this->getStatusCode(), $webResourceException->getResponse()->getStatusCode()); } }
public function testInvalidUrl() { $this->setExpectedException('InvalidArgumentException', 'Url "' . self::INVALID_URL . '" is not valid', 1); $this->wrapper->getConfiguration()->setUrlToLint(self::INVALID_URL); $this->wrapper->validate(); }