Skip to content
Snippets Groups Projects
Commit a8709725 authored by Demian Katz's avatar Demian Katz
Browse files

Incorporated VuFindHttp module test suite; added missing method required by tests.

parent 2125a64e
No related merge requests found
<phpunit bootstrap="./bootstrap.php" backupGlobals="false">
<testsuites>
<testsuite name="VuFindHttp">
<directory>../../VuFindHttp/tests/unit-tests/src</directory>
</testsuite>
<testsuite name="VuFindUnit">
<directory>unit-tests/src</directory>
</testsuite>
......
......@@ -57,6 +57,13 @@ class HttpService implements HttpServiceInterface
*/
protected $proxyConfig;
/**
* Default adapter
*
* @var \Zend\Http\Client\Adapter\AdapterInterface
*/
protected $defaultAdapter = null;
/**
* Constructor.
*
......@@ -149,6 +156,18 @@ class HttpService implements HttpServiceInterface
return $this->post($url, $body, \Zend\Http\Client::ENC_URLENCODED, $timeout);
}
/**
* Set a default HTTP adapter (primarily for testing purposes).
*
* @param \Zend\Http\Client\Adapter\AdapterInterface $adapter Adapter
*
* @return void
*/
public function setDefaultAdapter(\Zend\Http\Client\Adapter\AdapterInterface $adapter)
{
$this->defaultAdapter = $adapter;
}
/**
* Return a new HTTP client.
*
......@@ -162,6 +181,9 @@ class HttpService implements HttpServiceInterface
{
$client = new \Zend\Http\Client();
$client->setMethod($method);
if (null !== $this->defaultAdapter) {
$client->setAdapter($this->defaultAdapter);
}
if (null !== $url) {
$client->setUri($url);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment