Commit c574e8c0 authored by Bas de Nooijer's avatar Bas de Nooijer

Fix for PHP warnings when running unittests without pecl_http available

parent 630ee35d
...@@ -62,36 +62,39 @@ class Solarium_Client_Adapter_PeclHttpTest extends PHPUnit_Framework_TestCase ...@@ -62,36 +62,39 @@ class Solarium_Client_Adapter_PeclHttpTest extends PHPUnit_Framework_TestCase
public function requestProvider() public function requestProvider()
{ {
$methods = array( // prevents undefined constants errors
Solarium_Client_Request::METHOD_GET => array( if (function_exists('http_get')) {
'method' => HTTP_METH_GET, $methods = array(
'support' => true Solarium_Client_Request::METHOD_GET => array(
), 'method' => HTTP_METH_GET,
Solarium_Client_Request::METHOD_POST => array( 'support' => true
'method' => HTTP_METH_POST, ),
'support' => true Solarium_Client_Request::METHOD_POST => array(
), 'method' => HTTP_METH_POST,
Solarium_Client_Request::METHOD_HEAD => array( 'support' => true
'method' => HTTP_METH_HEAD, ),
'support' => true Solarium_Client_Request::METHOD_HEAD => array(
), 'method' => HTTP_METH_HEAD,
'PUT' => array( 'support' => true
'method' => HTTP_METH_PUT, ),
'support' => false 'PUT' => array(
), 'method' => HTTP_METH_PUT,
'DELETE' => array( 'support' => false
'method' => HTTP_METH_DELETE, ),
'support' => false 'DELETE' => array(
), 'method' => HTTP_METH_DELETE,
); 'support' => false
),
foreach ($methods as $method => $options) { );
$request = new Solarium_Client_Request;
$request->setMethod($method); foreach ($methods as $method => $options) {
$data[] = array_merge(array($request), $options); $request = new Solarium_Client_Request;
} $request->setMethod($method);
$data[] = array_merge(array($request), $options);
}
return $data; return $data;
}
} }
public function testToHttpRequestWithHeaders() public function testToHttpRequestWithHeaders()
......
Markdown is supported
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