/** * @dataProvider checkProvider */ public function testGuzzle4And5Check($content, $actualContent, $actualStatusCode, $resultClass, $method = 'GET', $body = null) { if (!class_exists('GuzzleHttp\\Client')) { $this->markTestSkipped('guzzlehttp/guzzle not installed.'); } $check = new GuzzleHttpService('http://www.example.com/foobar', array(), array(), '200', $content, $this->getMockGuzzle4And5Client($actualStatusCode, $actualContent), $method, $body); $result = $check->check(); $this->assertInstanceOf($resultClass, $result); }
/** * {@inheritDoc} */ public function check() { $result = parent::check(); if ($result instanceof Result\Success) { return $result; } $msg = $result->getMessage(); $msg = preg_replace('=\\/\\/(.+):{1}(.+)(\\@){1}=i', '//', $msg); $failure = new Result\Failure($msg, $result->getData()); return $failure; }
/** * @dataProvider checkProvider */ public function testCheck($content, $actualContent, $actualStatusCode, $resultClass, $method = 'GET', $body = null) { $check = new GuzzleHttpService('http://www.example.com/foobar', array(), array(), 200, $content, $this->getMockClient($actualStatusCode, $actualContent), $method, $body); $result = $check->check(); $this->assertInstanceOf($resultClass, $result); }