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
692a78ae
Commit
692a78ae
authored
Feb 24, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed tests
- added countable to iterators
parent
23f768f4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
6 deletions
+37
-6
library/Solarium/Document/ReadOnly.php
library/Solarium/Document/ReadOnly.php
+11
-1
library/Solarium/Result/Select.php
library/Solarium/Result/Select.php
+10
-1
library/Solarium/Result/Select/Facet/Field.php
library/Solarium/Result/Select/Facet/Field.php
+12
-2
tests/Solarium/Client/Request/SelectTest.php
tests/Solarium/Client/Request/SelectTest.php
+2
-1
tests/Solarium/Client/Request/UpdateTest.php
tests/Solarium/Client/Request/UpdateTest.php
+2
-1
No files found.
library/Solarium/Document/ReadOnly.php
View file @
692a78ae
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
/**
/**
* Solr query result read-only document
* Solr query result read-only document
*/
*/
class
Solarium_Document_ReadOnly
implements
IteratorAggregate
class
Solarium_Document_ReadOnly
implements
IteratorAggregate
,
Countable
{
{
/**
/**
...
@@ -111,4 +111,14 @@ class Solarium_Document_ReadOnly implements IteratorAggregate
...
@@ -111,4 +111,14 @@ class Solarium_Document_ReadOnly implements IteratorAggregate
return
new
ArrayIterator
(
$this
->
_fields
);
return
new
ArrayIterator
(
$this
->
_fields
);
}
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_fields
);
}
}
}
\ No newline at end of file
library/Solarium/Result/Select.php
View file @
692a78ae
...
@@ -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
IteratorAggregate
implements
IteratorAggregate
,
Countable
{
{
/**
/**
...
@@ -148,4 +148,13 @@ class Solarium_Result_Select extends Solarium_Result_Query
...
@@ -148,4 +148,13 @@ class Solarium_Result_Select extends Solarium_Result_Query
return
new
ArrayIterator
(
$this
->
_documents
);
return
new
ArrayIterator
(
$this
->
_documents
);
}
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_documents
);
}
}
}
\ No newline at end of file
library/Solarium/Result/Select/Facet/Field.php
View file @
692a78ae
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
/**
/**
* Select query facet result
* Select query facet result
*/
*/
class
Solarium_Result_Select_Facet_Field
implements
IteratorAggregate
class
Solarium_Result_Select_Facet_Field
implements
IteratorAggregate
,
Countable
{
{
/**
/**
...
@@ -76,6 +76,16 @@ class Solarium_Result_Select_Facet_Field implements IteratorAggregate
...
@@ -76,6 +76,16 @@ class Solarium_Result_Select_Facet_Field implements IteratorAggregate
*/
*/
public
function
getIterator
()
public
function
getIterator
()
{
{
return
new
ArrayIterator
(
$this
->
_documents
);
return
new
ArrayIterator
(
$this
->
_values
);
}
/**
* Countable implementation
*
* @return int
*/
public
function
count
()
{
return
count
(
$this
->
_values
);
}
}
}
}
\ No newline at end of file
tests/Solarium/Client/Request/SelectTest.php
View file @
692a78ae
...
@@ -118,7 +118,8 @@ class Solarium_Client_Request_SelectTest extends PHPUnit_Framework_TestCase
...
@@ -118,7 +118,8 @@ class Solarium_Client_Request_SelectTest extends PHPUnit_Framework_TestCase
{
{
$this
->
_query
->
addFacet
(
new
UnknownFacet
(
array
(
'key'
=>
'f1'
,
'field'
=>
'owner'
)));
$this
->
_query
->
addFacet
(
new
UnknownFacet
(
array
(
'key'
=>
'f1'
,
'field'
=>
'owner'
)));
$this
->
setExpectedException
(
'Solarium_Exception'
);
$this
->
setExpectedException
(
'Solarium_Exception'
);
new
Solarium_Client_Request_Select
(
$this
->
_options
,
$this
->
_query
);
$request
=
new
Solarium_Client_Request_Select
(
$this
->
_options
,
$this
->
_query
);
$request
->
getUri
();
}
}
}
}
...
...
tests/Solarium/Client/Request/UpdateTest.php
View file @
692a78ae
...
@@ -302,7 +302,8 @@ class Solarium_Client_Request_UpdateTest extends PHPUnit_Framework_TestCase
...
@@ -302,7 +302,8 @@ class Solarium_Client_Request_UpdateTest extends PHPUnit_Framework_TestCase
$query
->
add
(
'invalidcommand'
,
new
InvalidCommand
);
$query
->
add
(
'invalidcommand'
,
new
InvalidCommand
);
$this
->
setExpectedException
(
'Solarium_Exception'
);
$this
->
setExpectedException
(
'Solarium_Exception'
);
new
Solarium_Client_Request_Update
(
$this
->
_options
,
$query
);
$request
=
new
Solarium_Client_Request_Update
(
$this
->
_options
,
$query
);
$request
->
getRawData
();
}
}
}
}
...
...
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