Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
f5b632fe
Commit
f5b632fe
authored
Feb 24, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- refactoring of Solarium_Client classes
- updated phpdoc - updated tests
parent
0a08acb8
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
448 additions
and
344 deletions
+448
-344
library/Solarium/Client.php
library/Solarium/Client.php
+11
-12
library/Solarium/Client/Adapter.php
library/Solarium/Client/Adapter.php
+13
-2
library/Solarium/Client/Adapter/Http.php
library/Solarium/Client/Adapter/Http.php
+67
-68
library/Solarium/Client/Adapter/ZendHttp.php
library/Solarium/Client/Adapter/ZendHttp.php
+158
-0
library/Solarium/Client/Request.php
library/Solarium/Client/Request.php
+56
-17
library/Solarium/Client/Request/Ping.php
library/Solarium/Client/Request/Ping.php
+14
-2
library/Solarium/Client/Request/Select.php
library/Solarium/Client/Request/Select.php
+3
-1
library/Solarium/Client/Request/Update.php
library/Solarium/Client/Request/Update.php
+26
-5
library/Solarium/Client/Response.php
library/Solarium/Client/Response.php
+1
-0
library/Solarium/Configurable.php
library/Solarium/Configurable.php
+27
-9
library/Solarium/Document/ReadOnly.php
library/Solarium/Document/ReadOnly.php
+11
-1
library/Solarium/Document/ReadWrite.php
library/Solarium/Document/ReadWrite.php
+1
-1
library/Solarium/Exception.php
library/Solarium/Exception.php
+1
-1
library/Solarium/Query.php
library/Solarium/Query.php
+20
-1
library/Solarium/Query/Ping.php
library/Solarium/Query/Ping.php
+1
-2
library/Solarium/Result/Query.php
library/Solarium/Result/Query.php
+3
-0
library/Solarium/Result/Select.php
library/Solarium/Result/Select.php
+5
-54
library/Solarium/Result/Select/Facet/Field.php
library/Solarium/Result/Select/Facet/Field.php
+5
-56
library/Solarium/Result/Update.php
library/Solarium/Result/Update.php
+3
-0
library/Solarium/Version.php
library/Solarium/Version.php
+1
-1
tests/Solarium/Client/RequestTest.php
tests/Solarium/Client/RequestTest.php
+13
-8
tests/Solarium/Client/Response/PingTest.php
tests/Solarium/Client/Response/PingTest.php
+0
-55
tests/Solarium/Client/ResponseTest.php
tests/Solarium/Client/ResponseTest.php
+1
-1
tests/Solarium/ClientTest.php
tests/Solarium/ClientTest.php
+7
-7
tests/Solarium/Result/PingTest.php
tests/Solarium/Result/PingTest.php
+0
-40
No files found.
library/Solarium/Client.php
View file @
f5b632fe
...
@@ -68,7 +68,7 @@ class Solarium_Client extends Solarium_Configurable
...
@@ -68,7 +68,7 @@ class Solarium_Client extends Solarium_Configurable
'port'
=>
8983
,
'port'
=>
8983
,
'path'
=>
'/solr'
,
'path'
=>
'/solr'
,
'core'
=>
null
,
'core'
=>
null
,
'adapter'
=>
'Solarium_Client_Adapter_
Stream
'
,
'adapter'
=>
'Solarium_Client_Adapter_
Http
'
,
);
);
/**
/**
...
@@ -289,14 +289,13 @@ class Solarium_Client extends Solarium_Configurable
...
@@ -289,14 +289,13 @@ class Solarium_Client extends Solarium_Configurable
* </code>
* </code>
*
*
* @see Solarium_Query_Ping
* @see Solarium_Query_Ping
* @see Solarium_Result_Ping
*
*
* @internal This is a convenience method that forwards the query to the
adapter and
* @internal This is a convenience method that forwards the query to the
*
returns the adapter result, thus allowing for an easy to use and clean
*
adapter and returns the adapter result, thus allowing for an easy to use
* API.
*
and clean
API.
*
*
* @param Solarium_Query_Ping $query
* @param Solarium_Query_Ping $query
* @return
Solarium_Result_Ping
* @return
boolean
*/
*/
public
function
ping
(
$query
)
public
function
ping
(
$query
)
{
{
...
@@ -317,9 +316,9 @@ class Solarium_Client extends Solarium_Configurable
...
@@ -317,9 +316,9 @@ class Solarium_Client extends Solarium_Configurable
* @see Solarium_Query_Update
* @see Solarium_Query_Update
* @see Solarium_Result_Update
* @see Solarium_Result_Update
*
*
* @internal This is a convenience method that forwards the query to the
adapter and
* @internal This is a convenience method that forwards the query to the
*
returns the adapter result, thus allowing for an easy to use and clean
*
adapter and returns the adapter result, thus allowing for an easy to use
* API.
*
and clean
API.
*
*
* @param Solarium_Query_Update $query
* @param Solarium_Query_Update $query
* @return Solarium_Result_Update
* @return Solarium_Result_Update
...
@@ -342,9 +341,9 @@ class Solarium_Client extends Solarium_Configurable
...
@@ -342,9 +341,9 @@ class Solarium_Client extends Solarium_Configurable
* @see Solarium_Query_Select
* @see Solarium_Query_Select
* @see Solarium_Result_Select
* @see Solarium_Result_Select
*
*
* @internal This is a convenience method that forwards the query to the
adapter and
* @internal This is a convenience method that forwards the query to the
*
returns the adapter result, thus allowing for an easy to use and clean
*
adapter and returns the adapter result, thus allowing for an easy to use
* API.
*
and clean
API.
*
*
* @param Solarium_Query_Select $query
* @param Solarium_Query_Select $query
* @return Solarium_Result_Select
* @return Solarium_Result_Select
...
...
library/Solarium/Client/Adapter.php
View file @
f5b632fe
...
@@ -41,6 +41,17 @@
...
@@ -41,6 +41,17 @@
abstract
class
Solarium_Client_Adapter
extends
Solarium_Configurable
abstract
class
Solarium_Client_Adapter
extends
Solarium_Configurable
{
{
/**
* Default options
*
* @var array
*/
protected
$_options
=
array
(
'adapteroptions'
=>
array
(
'timeout'
=>
5
),
);
/**
/**
* Set options (overrides any existing values)
* Set options (overrides any existing values)
*
*
...
@@ -49,7 +60,7 @@ abstract class Solarium_Client_Adapter extends Solarium_Configurable
...
@@ -49,7 +60,7 @@ abstract class Solarium_Client_Adapter extends Solarium_Configurable
*/
*/
public
function
setOptions
(
$options
)
public
function
setOptions
(
$options
)
{
{
$this
->
_
options
=
$options
;
$this
->
_
setOptions
(
$options
,
true
)
;
}
}
/**
/**
...
@@ -70,7 +81,7 @@ abstract class Solarium_Client_Adapter extends Solarium_Configurable
...
@@ -70,7 +81,7 @@ abstract class Solarium_Client_Adapter extends Solarium_Configurable
*
*
* @abstract
* @abstract
* @param Solarium_Query_Ping $query
* @param Solarium_Query_Ping $query
* @return
Solarium_Result_Ping
* @return
boolean
*/
*/
abstract
public
function
ping
(
$query
);
abstract
public
function
ping
(
$query
);
...
...
library/Solarium/Client/Adapter/
Stream
.php
→
library/Solarium/Client/Adapter/
Http
.php
View file @
f5b632fe
...
@@ -38,20 +38,28 @@
...
@@ -38,20 +38,28 @@
/**
/**
* A very basic adapter using file_get_contents for retrieving data from Solr
* A very basic adapter using file_get_contents for retrieving data from Solr
*/
*/
class
Solarium_Client_Adapter_
Stream
extends
Solarium_Client_Adapter
class
Solarium_Client_Adapter_
Http
extends
Solarium_Client_Adapter
{
{
/**
/**
* Execute a select query and return a result object
* Default options
*
* @var array
*/
protected
$_options
=
array
(
'timeout'
=>
5
,
);
/**
* Executes a select query
*
*
* @param Solarium_Query_Select $query
* @param Solarium_Query_Select $query
* @return Solarium_Result_Select
* @return Solarium_Result_Select
*/
*/
public
function
select
(
$query
)
public
function
select
(
$query
)
{
{
$data
=
$this
->
_getSolrData
(
$request
=
new
Solarium_Client_Request_Select
(
$this
->
_options
,
$query
);
new
Solarium_Client_Request_Select
(
$this
->
_options
,
$query
)
$data
=
$this
->
_handleRequest
(
$request
);
);
$response
=
new
Solarium_Client_Response_Select
(
$query
,
$data
);
$response
=
new
Solarium_Client_Response_Select
(
$query
,
$data
);
return
$response
->
getResult
();
return
$response
->
getResult
();
...
@@ -59,102 +67,93 @@ class Solarium_Client_Adapter_Stream extends Solarium_Client_Adapter
...
@@ -59,102 +67,93 @@ class Solarium_Client_Adapter_Stream extends Solarium_Client_Adapter
}
}
/**
/**
* Execute
a ping query and return a result object
* Execute
s a ping query
*
*
* @param Solarium_Query_Ping $query
* @param Solarium_Query_Ping $query
* @return
Solarium_Result_Ping
* @return
boolean
*/
*/
public
function
ping
(
$query
)
public
function
ping
(
$query
)
{
{
$data
=
$this
->
_getSolrData
(
$request
=
new
Solarium_Client_Request_Ping
(
$this
->
_options
,
$query
);
new
Solarium_Client_Request
(
$this
->
_options
,
$query
),
return
(
boolean
)
$this
->
_handleRequest
(
$request
);
'xml'
);
$response
=
new
Solarium_Client_Response_Ping
(
$query
,
$data
);
return
$response
->
getResult
();
}
}
/**
/**
* Execute
an update query and return a result object
* Execute
s an update query
*
*
* @param Solarium_Query_Update $query
* @param Solarium_Query_Update $query
* @return Solarium_Result_Update
* @return Solarium_Result_Update
*/
*/
public
function
update
(
$query
)
public
function
update
(
$query
)
{
{
$data
=
$this
->
_getSolrData
(
$request
=
new
Solarium_Client_Request_Update
(
$this
->
_options
,
$query
);
new
Solarium_Client_Request_Update
(
$this
->
_options
,
$query
)
$data
=
$this
->
_handleRequest
(
$request
);
);
$response
=
new
Solarium_Client_Response_Update
(
$query
,
$data
);
$response
=
new
Solarium_Client_Response_Update
(
$query
,
$data
);
return
$response
->
getResult
();
return
$response
->
getResult
();
}
}
/**
/**
* Handle Solr communication and JSON decode
* Handle Solr communication
*
* @todo implement timeout
* @todo check http response code
*
*
* @throws Solarium_Exception
* @throws Solarium_Exception
* @param Solarium_Client_Request
* @param Solarium_Client_Request
* @return array
* @return array
*/
*/
protected
function
_
getSolrData
(
$request
,
$mode
=
'json'
)
protected
function
_
handleRequest
(
$request
)
{
{
if
(
null
!==
$request
&&
null
!==
$request
->
getPostData
())
{
$method
=
$request
->
getMethod
();
$context
=
stream_context_create
(
$context
=
stream_context_create
(
array
(
array
(
'http'
=>
array
(
'http'
=>
array
(
'method'
=>
$method
,
'method'
=>
'POST'
,
'timeout'
=>
$this
->
getOption
(
'timeout'
)
'content'
=>
$request
->
getPostData
(),
))
'header'
=>
'Content-Type: text/xml; charset=UTF-8'
,
),
)
);
);
}
else
{
$context
=
null
;
if
(
$method
==
Solarium_Client_Request
::
POST
)
{
$data
=
$request
->
getRawData
();
if
(
null
!==
$data
)
{
stream_context_set_option
(
$context
,
'http'
,
'content'
,
$data
);
stream_context_set_option
(
$context
,
'http'
,
'header'
,
'Content-Type: text/xml; charset=UTF-8'
);
}
}
}
$data
=
@
file_get_contents
(
$request
->
getUri
(),
false
,
$context
);
$data
=
@
file_get_contents
(
$request
->
getUrl
(),
false
,
$context
);
if
(
$method
==
Solarium_Client_Request
::
HEAD
)
{
// HEAD request has no result data
return
true
;
}
else
{
if
(
false
===
$data
)
{
if
(
false
===
$data
)
{
$error
=
error_get_last
();
$error
=
error_get_last
();
throw
new
Solarium_Exception
(
$error
[
'message'
]);
throw
new
Solarium_Exception
(
$error
[
'message'
]);
}
}
if
(
$mode
==
'json'
)
{
return
$this
->
_jsonDecode
(
$data
);
$data
=
json_decode
(
$data
,
true
);
if
(
null
===
$data
)
{
throw
new
Solarium_Exception
(
'Solr JSON response could not be decoded'
);
}
}
}
else
if
(
$mode
==
'xml'
)
{
$data
=
$this
->
simplexmlToArray
(
simplexml_load_string
(
$data
));
}
else
{
throw
new
Solarium_Exception
(
'Unknown Solr client data mode'
);
}
}
return
$data
;
}
/**
function
simplexmlToArray
(
$xml
)
* TODO
*
* @throws Solarium_Exception
* @param $data
* @return mixed
*/
protected
function
_jsonDecode
(
$data
)
{
{
if
(
get_class
(
$xml
)
==
'SimpleXMLElement'
)
{
$data
=
json_decode
(
$data
,
true
);
$attributes
=
$xml
->
attributes
();
if
(
null
===
$data
)
{
foreach
(
$attributes
as
$k
=>
$v
)
{
throw
new
Solarium_Exception
(
if
(
$v
)
$a
[
$k
]
=
(
string
)
$v
;
'Solr JSON response could not be decoded'
}
);
$x
=
$xml
;
$xml
=
get_object_vars
(
$xml
);
}
if
(
is_array
(
$xml
))
{
if
(
count
(
$xml
)
==
0
)
return
(
string
)
$x
;
// for CDATA
foreach
(
$xml
as
$key
=>
$value
)
{
$r
[
$key
]
=
$this
->
simplexmlToArray
(
$value
);
}
if
(
isset
(
$a
))
$r
[
'@attributes'
]
=
$a
;
// Attributes
return
$r
;
}
return
(
string
)
$xml
;
}
}
return
$data
;
}
}
}
\ No newline at end of file
library/Solarium/Client/
Response/Ping
.php
→
library/Solarium/Client/
Adapter/ZendHttp
.php
View file @
f5b632fe
...
@@ -36,19 +36,123 @@
...
@@ -36,19 +36,123 @@
*/
*/
/**
/**
* Handles Solr ping response, for use in adapters.
* An adapter that uses a Zend_Http_Client for Solr request
*
* The Zend Framework HTTP client has many great features and has lots of
* configuration options. For more info see the manual at
* {@link http://framework.zend.com/manual/en/zend.http.html}
*
* To use this adapter you need to have the Zend Framework in your include path,
* autoloader or manually included.
*/
*/
class
Solarium_Client_
Response_Ping
extends
Solarium_Client_Response
class
Solarium_Client_
Adapter_ZendHttp
extends
Solarium_Client_Adapter_Http
{
{
public
function
getResult
()
/**
* Zend Http instance for communication with Solr
*
* @var Zend_Http_Client
*/
protected
$_zendHttp
;
/**
* Set options (overrides any existing values)
*
* If the options array has an 'adapteroptions' entry it is forwarded to the
* Zend_Http_Client. See the Zend_Http_Clientdocs for the many config
* options available.
*
* The $options param should be an array or an object that has a toArray
* method, like Zend_Config
*
* @param array|object $options
* @return Solarium_Client_Adapter_ZendHttp Provides fluent interface
*/
public
function
setOptions
(
$options
)
{
parent
::
setOptions
(
$options
);
if
(
null
!==
$this
->
_zendHttp
&&
isset
(
$this
->
_options
[
'adapteroptions'
]))
{
$this
->
_zendHttp
->
setOptions
(
$this
->
_options
[
'adapteroptions'
]);
}
return
$this
;
}
/**
* Set the Zend_Http_Client instance
*
* This method is optional, if you don't set a client it will be created
* upon first use, using default and/or custom options (the most common use
* case)
*
* @param Zend_Http_Client $zendHttp
* @return Solarium_Client_Adapter_ZendHttp Provides fluent interface
*/
public
function
setZendHttp
(
$zendHttp
)
{
{
$resultClass
=
$this
->
_query
->
getOption
(
'resultclass'
);
$this
->
_zendHttp
=
$zendHttp
;
return
$this
;
}
/**
* Get the Zend_Http_Client instance
*
* If no instance is available yet it will be created automatically based on
* options.
*
* You can use this method to get a reference to the client instance to set
* options, get the last response and use many other features offered by the
* Zend_Http_Client API.
*
* @return Zend_Http_Client
*/
public
function
getZendHttp
()
{
if
(
null
==
$this
->
_zendHttp
)
{
$options
=
null
;
if
(
isset
(
$this
->
_options
[
'adapteroptions'
]))
{
$options
=
$this
->
_options
[
'adapteroptions'
];
}
$this
->
_zendHttp
=
new
Zend_Http_Client
(
null
,
$options
);
}
return
$this
->
_zendHttp
;
}
/**
* Execute a Solr request using the Zend_Http_Client instance
*
* @param Solarium_Client_Request $request
* @return string
*/
protected
function
_handleRequest
(
$request
)
{
$client
=
$this
->
getZendHttp
();
$client
->
setMethod
(
$request
->
getMethod
());
$client
->
setUri
(
$request
->
getUri
());
$client
->
setRawData
(
$request
->
getRawData
());
$response
=
$client
->
request
();
if
(
$request
->
getMethod
()
==
Solarium_Client_Request
::
HEAD
)
{
return
true
;
}
else
{
$data
=
$response
->
getBody
();
$type
=
$response
->
getHeader
(
'Content-Type'
);
switch
(
$type
)
{
case
'text/plain; charset=utf-8'
:
return
$this
->
_jsonDecode
(
$data
);
break
;
default
:
throw
new
Solarium_Exception
(
'Unknown content-type: '
.
$type
);
break
;
}
}
return
new
$resultClass
(
$this
->
_data
[
'ping'
][
'status'
],
0
);
}
}
}
}
\ No newline at end of file
library/Solarium/Client/Request.php
View file @
f5b632fe
...
@@ -38,26 +38,74 @@
...
@@ -38,26 +38,74 @@
/**
/**
*
*
*/
*/
class
Solarium_Client_Request
abstract
class
Solarium_Client_Request
{
{
/**
* Http request methods
*/
const
GET
=
'GET'
;
const
POST
=
'POST'
;
const
HEAD
=
'HEAD'
;
protected
$_postData
=
null
;
/**
* TODO
protected
$_params
=
array
();
*
* @var Solarium_Query
*/
protected
$_query
;
/**
* TODO
*
* @var array
*/
protected
$_options
;
protected
$_options
;
/**
* TODO
*
* @var array
*/
protected
$_params
;
/**
* TODO
*
* @param array|object $options
* @param Solarium_Query $query
*/
public
function
__construct
(
$options
,
$query
)
public
function
__construct
(
$options
,
$query
)
{
{
$this
->
_options
=
$options
;
$this
->
_options
=
$options
;
$this
->
_query
=
$query
;
$this
->
_query
=
$query
;
$this
->
_init
();
}
}
protected
function
_init
()
/**
* TODO
*
* @return string
*/
public
function
getMethod
()
{
{
return
self
::
GET
;
}
/**
* TODO
*
* @abstract
* @return void
*/
abstract
public
function
getUri
();
/**
* TODO
*
* @return null
*/
public
function
getRawData
()
{
return
null
;
}
}
/**
/**
...
@@ -65,7 +113,7 @@ class Solarium_Client_Request
...
@@ -65,7 +113,7 @@ class Solarium_Client_Request
*
*
* @return string
* @return string
*/
*/
public
function
getUrl
()
public
function
buildUri
()
{
{
$queryString
=
''
;
$queryString
=
''
;
if
(
count
(
$this
->
_params
)
>
0
)
{
if
(
count
(
$this
->
_params
)
>
0
)
{
...
@@ -89,11 +137,6 @@ class Solarium_Client_Request
...
@@ -89,11 +137,6 @@ class Solarium_Client_Request
.
$queryString
;
.
$queryString
;
}
}
public
function
getPostData
()
{
return
$this
->
_postData
;
}
/**
/**
* Render a boolean attribute
* Render a boolean attribute
*
*
...
@@ -154,10 +197,6 @@ class Solarium_Client_Request
...
@@ -154,10 +197,6 @@ class Solarium_Client_Request
return
$value
;
return
$value
;
}
}
public
function
getParams
()
{
return
$this
->
_params
;
}
public
function
addParam
(
$name
,
$value
)
public
function
addParam
(
$name
,
$value
)
{
{
...
...
library/Solarium/
Resul
t/Ping.php
→
library/Solarium/
Client/Reques
t/Ping.php
View file @
f5b632fe
...
@@ -32,10 +32,22 @@
...
@@ -32,10 +32,22 @@
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
*
*
* @package Solarium
* @package Solarium
* @subpackage
Resul
t
* @subpackage
Clien
t
*/
*/
class
Solarium_Result_Ping
extends
Solarium_Result_Query
/**
* Builds ping request, for use in adapters.
*/
class
Solarium_Client_Request_Ping
extends
Solarium_Client_Request
{
{
public
function
getUri
()
{
return
$this
->
buildUri
();
}
public
function
getMethod
()
{
return
self
::
HEAD
;
}
}
}
\ No newline at end of file
library/Solarium/Client/Request/Select.php
View file @
f5b632fe
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
class
Solarium_Client_Request_Select
extends
Solarium_Client_Request
class
Solarium_Client_Request_Select
extends
Solarium_Client_Request
{
{
public
function
_init
()
public
function
getUri
()
{
{
$this
->
_params
=
array
(
$this
->
_params
=
array
(
'q'
=>
$this
->
_query
->
getQuery
(),
'q'
=>
$this
->
_query
->
getQuery
(),
...
@@ -90,6 +90,8 @@ class Solarium_Client_Request_Select extends Solarium_Client_Request
...
@@ -90,6 +90,8 @@ class Solarium_Client_Request_Select extends Solarium_Client_Request
}
}
}
}
}
}
return
$this
->
buildUri
();
}
}
public
function
addFacetField
(
$facet
)
public
function
addFacetField
(
$facet
)
...
...
library/Solarium/Client/Request/Update.php
View file @
f5b632fe
...
@@ -42,13 +42,34 @@ class Solarium_Client_Request_Update extends Solarium_Client_Request
...
@@ -42,13 +42,34 @@ class Solarium_Client_Request_Update extends Solarium_Client_Request
{
{
/**
/**
* @throws Solarium_Exception
* TODO
* @return void
*
* @return string
*/
public
function
getMethod
()
{
return
self
::
POST
;
}
/**
* TODO
*
* @return string
*/
*/
public
function
_init
()
public
function
getUri
()
{
{
$this
->
_params
=
array
(
'wt'
=>
'json'
);
$this
->
_params
=
array
(
'wt'
=>
'json'
);
return
$this
->
buildUri
();
}
/**
* TODO
*
* @throws Solarium_Exception
* @return string
*/
public
function
getRawData
()
{
$xml
=
'<update>'
;
$xml
=
'<update>'
;
foreach
(
$this
->
_query
->
getCommands
()
AS
$command
)
{
foreach
(
$this
->
_query
->
getCommands
()
AS
$command
)
{
switch
(
$command
->
getType
())
{
switch
(
$command
->
getType
())
{
...
@@ -74,7 +95,7 @@ class Solarium_Client_Request_Update extends Solarium_Client_Request
...
@@ -74,7 +95,7 @@ class Solarium_Client_Request_Update extends Solarium_Client_Request
}
}
$xml
.=
'</update>'
;
$xml
.=
'</update>'
;
$this
->
_postData
=
$xml
;
return
$xml
;
}
}
/**
/**
...
...
library/Solarium/Client/Response.php
View file @
f5b632fe
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
*/
*/
abstract
class
Solarium_Client_Response
abstract
class
Solarium_Client_Response
{
{
protected
$_query
;
protected
$_query
;
protected
$_data
;
protected
$_data
;
...
...
library/Solarium/Configurable.php
View file @
f5b632fe
...
@@ -57,20 +57,37 @@ class Solarium_Configurable
...
@@ -57,20 +57,37 @@ class Solarium_Configurable
/**
/**
* Constructor
* Constructor
*
*
* If options are passed they will be merged with {@link $_options}, with
* If options are passed they will be merged with {@link $_options} using
* new values overwriting any existing (default) values.
* the {@link _setOptions()} method.
*
* After handling the options the {@link _init()} method is called.
*
* @throws Solarium_Exception
* @param array|Zend_Config $options
* @return void
*/
public
function
__construct
(
$options
=
null
)
{
$this
->
_setOptions
(
$options
);
$this
->
_init
();
}
/**
* Set options
*
*
* If $options is an object it will be converted into an array by called
* If $options is an object it will be converted into an array by called
* it's toArray method. This is compatible with the Zend_Config classes in
* it's toArray method. This is compatible with the Zend_Config classes in
* Zend Framework, but can also easily be implemented in any other object.
* Zend Framework, but can also easily be implemented in any other object.
*
*
* After handling the options the {@link _init()} method is called.
*
* @throws Solarium_Exception
* @throws Solarium_Exception
* @param array|Zend_Config $options
* @param array|Zend_Config $options
* @param boolean $overwrite True for overwriting existing options, false
* for merging (new values overwrite old ones if needed)
*
* @return void
* @return void
*/
*/
p
ublic
function
__construct
(
$options
=
null
)
p
rotected
function
_setOptions
(
$options
,
$overwrite
=
false
)
{
{
if
(
null
!==
$options
)
{
if
(
null
!==
$options
)
{
// first convert to array if needed
// first convert to array if needed
...
@@ -83,11 +100,12 @@ class Solarium_Configurable
...
@@ -83,11 +100,12 @@ class Solarium_Configurable
}
}
}
}
if
(
true
==
$overwrite
)
{
$this
->
_options
=
$options
;
}
else
{
$this
->
_options
=
array_merge
(
$this
->
_options
,
$options
);
$this
->
_options
=
array_merge
(
$this
->
_options
,
$options
);
}
}
}
$this
->
_init
();
}
}
/**
/**
...
...
library/Solarium/Document/ReadOnly.php
View file @
f5b632fe
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
/**
/**
* Solr query result read-only document
* Solr query result read-only document
*/
*/
class
Solarium_Document_ReadOnly
class
Solarium_Document_ReadOnly
implements
IteratorAggregate
{
{
/**
/**
...
@@ -101,4 +101,14 @@ class Solarium_Document_ReadOnly
...
@@ -101,4 +101,14 @@ class Solarium_Document_ReadOnly
throw
new
Solarium_Exception
(
'A readonly document cannot be altered'
);
throw
new
Solarium_Exception
(
'A readonly document cannot be altered'
);
}
}
/**
* IteratorAggregate implementation
*
* @return ArrayIterator
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
_fields
);
}
}
}
\ No newline at end of file
library/Solarium/Document/ReadWrite.php
View file @
f5b632fe
...
@@ -56,7 +56,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
...
@@ -56,7 +56,7 @@ class Solarium_Document_ReadWrite extends Solarium_Document_ReadOnly
protected
$_fieldBoosts
;
protected
$_fieldBoosts
;
/**
/**
* Constructor
.
* Constructor
*
*
* @param array $fields
* @param array $fields
*/
*/
...
...
library/Solarium/Exception.php
View file @
f5b632fe
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
* Solarium specific exception
* Solarium specific exception
*
*
* All exceptions thrown by Solarium are of this type. This way you can easily
* All exceptions thrown by Solarium are of this type. This way you can easily
* catch Solarium exception and keep them separate from your own exceptions.
* catch Solarium exception
s
and keep them separate from your own exceptions.
*
*
* @package Solarium
* @package Solarium
*/
*/
...
...
library/Solarium/Query.php
View file @
f5b632fe
...
@@ -36,7 +36,10 @@
...
@@ -36,7 +36,10 @@
*/
*/
/**
/**
* Base class for all queries
* Base class for all query types, not intended for direct usage
*
* @package Solarium
* @subpackage Query
*/
*/
class
Solarium_Query
extends
Solarium_Configurable
class
Solarium_Query
extends
Solarium_Configurable
{
{
...
@@ -65,6 +68,13 @@ class Solarium_Query extends Solarium_Configurable
...
@@ -65,6 +68,13 @@ class Solarium_Query extends Solarium_Configurable
/**
/**
* Set resultclass option
* Set resultclass option
*
*
* If you set a custom result class it must be available through autoloading
* or a manual require before calling this method. This is your
* responsibility.
*
* Also you need to make sure it extends the orginal result class of the
* query or has an identical API.
*
* @param string $classname
* @param string $classname
* @return Solarium_Query Provides fluent interface
* @return Solarium_Query Provides fluent interface
*/
*/
...
@@ -85,6 +95,15 @@ class Solarium_Query extends Solarium_Configurable
...
@@ -85,6 +95,15 @@ class Solarium_Query extends Solarium_Configurable
/**
/**
* Escape special Solr characters in a value
* Escape special Solr characters in a value
*
* This can be used for building Solr query strings. Any (user) input for
* the query can be passed to this function to prevent any issues with
* special characters.
*
* Do mind that you cannot build a complete query first and then pass it to
* this method, the whole query will be escaped. You need to escape only the
* 'content' of your query.
*
* @param string $string
* @param string $string
* @return string
* @return string
*/
*/
...
...
library/Solarium/Query/Ping.php
View file @
f5b632fe
...
@@ -48,7 +48,6 @@ class Solarium_Query_Ping extends Solarium_Query
...
@@ -48,7 +48,6 @@ class Solarium_Query_Ping extends Solarium_Query
*/
*/
protected
$_options
=
array
(
protected
$_options
=
array
(
'path'
=>
'/admin/ping'
,
'path'
=>
'/admin/ping'
,
'resultclass'
=>
'Solarium_Result_Ping'
,
);
);
}
}
\ No newline at end of file
library/Solarium/Result/Query.php
View file @
f5b632fe
...
@@ -37,6 +37,9 @@
...
@@ -37,6 +37,9 @@
/**
/**
* Query result
* Query result
*
* @package Solarium
* @subpackage Result
*/
*/
class
Solarium_Result_Query
class
Solarium_Result_Query
{
{
...
...
library/Solarium/Result/Select.php
View file @
f5b632fe
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
* Select query result
* Select query result
*/
*/
class
Solarium_Result_Select
extends
Solarium_Result_Query
class
Solarium_Result_Select
extends
Solarium_Result_Query
implements
Iterator
,
Countabl
e
implements
Iterator
Aggregat
e
{
{
/**
/**
...
@@ -139,62 +139,13 @@ class Solarium_Result_Select extends Solarium_Result_Query
...
@@ -139,62 +139,13 @@ class Solarium_Result_Select extends Solarium_Result_Query
}
}
/**
/**
*
Count method for Countable interface
*
IteratorAggregate implementation
*
*
* @return int
* @return ArrayIterator
*/
public
function
count
()
{
return
count
(
$this
->
_documents
);
}
/**
* Iterator implementation
*
* @return void
*/
public
function
rewind
()
{
$this
->
_position
=
0
;
}
/**
* Iterator implementation
*
* @return Solarium_Result_Select_Document
*/
function
current
()
{
return
$this
->
_documents
[
$this
->
_position
];
}
/**
* Iterator implementation
*
* @return integer
*/
public
function
key
()
{
return
$this
->
_position
;
}
/**
* Iterator implementation
*
* @return void
*/
*/
public
function
next
()
public
function
getIterator
()
{
{
++
$this
->
_position
;
return
new
ArrayIterator
(
$this
->
_documents
)
;
}
}
/**
* Iterator implementation
*
* @return boolean
*/
public
function
valid
()
{
return
isset
(
$this
->
_documents
[
$this
->
_position
]);
}
}
}
\ No newline at end of file
library/Solarium/Result/Select/Facet/Field.php
View file @
f5b632fe
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
/**
/**
* Select query facet result
* Select query facet result
*/
*/
class
Solarium_Result_Select_Facet_Field
implements
Iterator
,
Countabl
e
class
Solarium_Result_Select_Facet_Field
implements
Iterator
Aggregat
e
{
{
/**
/**
...
@@ -70,63 +70,12 @@ class Solarium_Result_Select_Facet_Field implements Iterator, Countable
...
@@ -70,63 +70,12 @@ class Solarium_Result_Select_Facet_Field implements Iterator, Countable
}
}
/**
/**
*
Count method for Countable interface
*
IteratorAggregate implementation
*
*
* @return
int
* @return
ArrayIterator
*/
*/
public
function
count
()
public
function
getIterator
()
{
{
return
count
(
$this
->
_value
s
);
return
new
ArrayIterator
(
$this
->
_document
s
);
}
}
/**
* Iterator implementation
*
* @return void
*/
public
function
rewind
()
{
reset
(
$this
->
_values
);
}
/**
* Iterator implementation
*
* @return Solarium_Result_Select_Document
*/
function
current
()
{
return
current
(
$this
->
_values
);
}
/**
* Iterator implementation
*
* @return integer
*/
public
function
key
()
{
return
key
(
$this
->
_values
);
}
/**
* Iterator implementation
*
* @return void
*/
public
function
next
()
{
next
(
$this
->
_values
);
}
/**
* Iterator implementation
*
* @return boolean
*/
public
function
valid
()
{
return
(
current
(
$this
->
_values
)
!==
false
);
}
}
}
\ No newline at end of file
library/Solarium/Result/Update.php
View file @
f5b632fe
...
@@ -37,6 +37,9 @@
...
@@ -37,6 +37,9 @@
/**
/**
* Update result
* Update result
*
* @package Solarium
* @subpackage Result
*/
*/
class
Solarium_Result_Update
extends
Solarium_Result_Query
class
Solarium_Result_Update
extends
Solarium_Result_Query
{
{
...
...
library/Solarium/Version.php
View file @
f5b632fe
...
@@ -101,7 +101,7 @@ class Solarium_Version
...
@@ -101,7 +101,7 @@ class Solarium_Version
*/
*/
static
public
function
checkExact
(
$version
)
static
public
function
checkExact
(
$version
)
{
{
return
(
substr
(
self
::
VERSION
,
0
,
strlen
(
$version
))
==
$version
);
return
(
substr
(
self
::
VERSION
,
0
,
strlen
(
$version
))
==
$version
);
}
}
...
...
tests/Solarium/Client/RequestTest.php
View file @
f5b632fe
...
@@ -49,22 +49,22 @@ class Solarium_Client_RequestTest extends PHPUnit_Framework_TestCase
...
@@ -49,22 +49,22 @@ class Solarium_Client_RequestTest extends PHPUnit_Framework_TestCase
return
new
$class
(
$options
,
$query
);
return
new
$class
(
$options
,
$query
);
}
}
public
function
testGetUr
l
()
public
function
testGetUr
i
()
{
{
$this
->
assertEquals
(
$this
->
assertEquals
(
'http://127.0.0.1:80/solr/mypath?'
,
'http://127.0.0.1:80/solr/mypath?'
,
$this
->
_getRequest
(
$this
->
_options
)
->
getUr
l
()
$this
->
_getRequest
(
$this
->
_options
)
->
getUr
i
()
);
);
}
}
public
function
testGetUr
l
WithCore
()
public
function
testGetUr
i
WithCore
()
{
{
$options
=
$this
->
_options
;
$options
=
$this
->
_options
;
$options
[
'core'
]
=
'core0'
;
$options
[
'core'
]
=
'core0'
;
$this
->
assertEquals
(
$this
->
assertEquals
(
'http://127.0.0.1:80/solr/core0/mypath?'
,
'http://127.0.0.1:80/solr/core0/mypath?'
,
$this
->
_getRequest
(
$options
)
->
getUr
l
()
$this
->
_getRequest
(
$options
)
->
getUr
i
()
);
);
}
}
...
@@ -100,19 +100,19 @@ class Solarium_Client_RequestTest extends PHPUnit_Framework_TestCase
...
@@ -100,19 +100,19 @@ class Solarium_Client_RequestTest extends PHPUnit_Framework_TestCase
);
);
}
}
public
function
testGetUr
l
WithParams
()
public
function
testGetUr
i
WithParams
()
{
{
$this
->
assertEquals
(
$this
->
assertEquals
(
'http://127.0.0.1:80/solr/mypath?wt=json&fq=category%3A1&fq=published%3Atrue'
,
'http://127.0.0.1:80/solr/mypath?wt=json&fq=category%3A1&fq=published%3Atrue'
,
$this
->
_getRequest
(
$this
->
_options
,
'TestRequest'
)
->
getUr
l
()
$this
->
_getRequest
(
$this
->
_options
,
'TestRequest'
)
->
getUr
i
()
);
);
}
}
public
function
testGet
Post
Data
()
public
function
testGet
Raw
Data
()
{
{
$this
->
assertEquals
(
$this
->
assertEquals
(
'<data>xyz</data>'
,
'<data>xyz</data>'
,
$this
->
_getRequest
(
$this
->
_options
,
'TestRequest'
)
->
get
Postd
ata
()
$this
->
_getRequest
(
$this
->
_options
,
'TestRequest'
)
->
get
RawD
ata
()
);
);
}
}
...
@@ -173,6 +173,11 @@ class Solarium_Client_RequestTest extends PHPUnit_Framework_TestCase
...
@@ -173,6 +173,11 @@ class Solarium_Client_RequestTest extends PHPUnit_Framework_TestCase
class
TestRequest
extends
Solarium_Client_Request
class
TestRequest
extends
Solarium_Client_Request
{
{
public
function
getUri
()
{
return
$this
->
buildUri
();
}
protected
function
_init
()
protected
function
_init
()
{
{
$this
->
_postData
=
'<data>xyz</data>'
;
$this
->
_postData
=
'<data>xyz</data>'
;
...
...
tests/Solarium/Client/Response/PingTest.php
deleted
100644 → 0
View file @
0a08acb8
<?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_Client_Response_PingTest
extends
PHPUnit_Framework_TestCase
{
public
function
testGetResult
()
{
$query
=
new
Solarium_Query_Ping
;
$response
=
new
Solarium_Client_Response_Ping
(
$query
);
$this
->
assertThat
(
$response
->
getResult
(),
$this
->
isInstanceOf
(
$query
->
getResultClass
()));
}
public
function
testGetResultWithCustomClass
()
{
$query
=
new
Solarium_Query_Ping
;
$query
->
setResultClass
(
'MyPingResult'
);
$response
=
new
Solarium_Client_Response_Ping
(
$query
);
$this
->
assertThat
(
$response
->
getResult
(),
$this
->
isInstanceOf
(
$query
->
getResultClass
()));
}
}
class
MyPingResult
extends
Solarium_Result_Ping
{
}
tests/Solarium/Client/ResponseTest.php
View file @
f5b632fe
...
@@ -34,7 +34,7 @@ class Solarium_Client_ResponseTest extends PHPUnit_Framework_TestCase
...
@@ -34,7 +34,7 @@ class Solarium_Client_ResponseTest extends PHPUnit_Framework_TestCase
public
function
testConstructor
()
public
function
testConstructor
()
{
{
$query
=
new
Solarium_Query_
Ping
;
$query
=
new
Solarium_Query_
Update
;
$data
=
array
(
'response'
=>
null
);
$data
=
array
(
'response'
=>
null
);
$response
=
new
MyTestResponse
(
$query
,
$data
);
$response
=
new
MyTestResponse
(
$query
,
$data
);
...
...
tests/Solarium/ClientTest.php
View file @
f5b632fe
...
@@ -97,11 +97,11 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
...
@@ -97,11 +97,11 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$options
=
$client
->
getOptions
();
$options
=
$client
->
getOptions
();
// initialising at adapter creation
// initialising at adapter creation
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Stream
'
,
array
(
'setOptions'
));
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Http
'
,
array
(
'setOptions'
));
$observer
->
expects
(
$this
->
once
())
$observer
->
expects
(
$this
->
once
())
->
method
(
'setOptions'
)
->
method
(
'setOptions'
)
->
with
(
$this
->
equalTo
(
$options
));
->
with
(
$this
->
equalTo
(
$options
));
$client
->
setAdapter
(
$observer
)
->
getAdapter
()
;
$client
->
setAdapter
(
$observer
);
}
}
public
function
testOptionForwardingToAdapterAfterChange
()
public
function
testOptionForwardingToAdapterAfterChange
()
...
@@ -112,7 +112,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
...
@@ -112,7 +112,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$options
=
$client
->
getOptions
();
$options
=
$client
->
getOptions
();
$options
[
'host'
]
=
$newHostValue
;
$options
[
'host'
]
=
$newHostValue
;
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Stream
'
,
array
(
'setOptions'
));
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Http
'
,
array
(
'setOptions'
));
$observer
->
expects
(
$this
->
at
(
1
))
$observer
->
expects
(
$this
->
at
(
1
))
->
method
(
'setOptions'
)
->
method
(
'setOptions'
)
->
with
(
$this
->
equalTo
(
$options
));
->
with
(
$this
->
equalTo
(
$options
));
...
@@ -127,7 +127,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
...
@@ -127,7 +127,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$query
=
new
Solarium_Query_Select
;
$query
=
new
Solarium_Query_Select
;
// initialising at adapter creation
// initialising at adapter creation
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Stream
'
,
array
(
'select'
));
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Http
'
,
array
(
'select'
));
$observer
->
expects
(
$this
->
once
())
$observer
->
expects
(
$this
->
once
())
->
method
(
'select'
)
->
method
(
'select'
)
->
with
(
$this
->
equalTo
(
$query
));
->
with
(
$this
->
equalTo
(
$query
));
...
@@ -142,7 +142,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
...
@@ -142,7 +142,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$query
=
new
Solarium_Query_Ping
;
$query
=
new
Solarium_Query_Ping
;
// initialising at adapter creation
// initialising at adapter creation
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Stream
'
,
array
(
'ping'
));
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Http
'
,
array
(
'ping'
));
$observer
->
expects
(
$this
->
once
())
$observer
->
expects
(
$this
->
once
())
->
method
(
'ping'
)
->
method
(
'ping'
)
->
with
(
$this
->
equalTo
(
$query
));
->
with
(
$this
->
equalTo
(
$query
));
...
@@ -157,7 +157,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
...
@@ -157,7 +157,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
$query
=
new
Solarium_Query_Update
;
$query
=
new
Solarium_Query_Update
;
// initialising at adapter creation
// initialising at adapter creation
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Stream
'
,
array
(
'update'
));
$observer
=
$this
->
getMock
(
'Solarium_Client_Adapter_
Http
'
,
array
(
'update'
));
$observer
->
expects
(
$this
->
once
())
$observer
->
expects
(
$this
->
once
())
->
method
(
'update'
)
->
method
(
'update'
)
->
with
(
$this
->
equalTo
(
$query
));
->
with
(
$this
->
equalTo
(
$query
));
...
@@ -168,7 +168,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
...
@@ -168,7 +168,7 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
}
}
class
MyAdapter
extends
Solarium_Client_Adapter_
Stream
{
class
MyAdapter
extends
Solarium_Client_Adapter_
Http
{
public
function
select
(
$query
)
public
function
select
(
$query
)
{
{
...
...
tests/Solarium/Result/PingTest.php
deleted
100644 → 0
View file @
0a08acb8
<?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
Solarium_Result_QueryTest
{
public
function
setUp
()
{
$this
->
_result
=
new
Solarium_Result_Ping
(
0
,
45
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment