Commit 3c4ab020 authored by Bas de Nooijer's avatar Bas de Nooijer

- small fixes

parent 2e589683
......@@ -133,17 +133,17 @@ class Solarium_Client_Adapter_Http extends Solarium_Client_Adapter
*/
protected function _getData($uri, $context)
{
// @codeCoverageIgnoreStart
$data = @file_get_contents($uri, false, $context);
// @codeCoverageIgnoreStart
if (isset($http_response_header)) {
$headers = $http_response_header;
} else {
$headers = array();
}
// @codeCoverageIgnoreEnd
return array($data, $headers);
// @codeCoverageIgnoreEnd
}
}
\ No newline at end of file
......@@ -173,7 +173,7 @@ class Solarium_Client_Adapter_ZendHttp extends Solarium_Client_Adapter
}
// this is used because getHeaders doesn't return the HTTP header...
$headers = explode("\n",$response->getHeadersAsString());
$headers = explode("\n", $response->getHeadersAsString());
return new Solarium_Client_Response($data, $headers);
}
......
......@@ -295,7 +295,7 @@ class Solarium_Client_Request extends Solarium_Configurable
/**
* Set request headers
*
* @header array $headers
* @param array $headers
* @return Solarium_Client_Request
*/
public function setHeaders($headers)
......@@ -308,7 +308,7 @@ class Solarium_Client_Request extends Solarium_Configurable
/**
* Add a request header
*
* @header string|array $value
* @param string|array $value
* @return Solarium_Client_Request
*/
public function addHeader($value)
......@@ -321,7 +321,7 @@ class Solarium_Client_Request extends Solarium_Configurable
/**
* Add multiple headers to the request
*
* @header array $headers
* @param array $headers
* @return Solarium_Client_Request
*/
public function addHeaders($headers)
......
......@@ -55,7 +55,7 @@ class Solarium_Client_RequestBuilder_Select_Component_Highlighting
public function build($component, $request)
{
// enable highlighting
$request->addParam('hl','true');
$request->addParam('hl', 'true');
$request->addParam('hl.fl', $component->getFields());
$request->addParam('hl.snippets', $component->getSnippets());
......
......@@ -39,7 +39,8 @@
/**
* Ping query result
*
* A ping query has no useful result (other than being succesful) so this class has no api
* A ping query has no useful result so only a dummy status var is available.
* If you don't get an exception for a ping query it was succesful.
*
* @package Solarium
* @subpackage Result
......@@ -47,4 +48,17 @@
class Solarium_Result_Ping
{
/**
* Get Solr status code
*
* Since no status is returned for a ping, a default of 0 is used.
* If you don't get an exception for a ping query it was succesful.
*
* @return int
*/
public function getStatus()
{
return 0;
}
}
\ No newline at end of file
<?php
/**
* Copyright 2011 Bas de Nooijer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this listof conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the copyright holder.
*/
class Solarium_Result_PingTest extends PHPUnit_Framework_TestCase
{
public function testGetStatus()
{
$ping = new Solarium_Result_Ping();
$this->assertEquals(
0,
$ping->getStatus()
);
}
}
\ No newline at end of file
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