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
9b84d58f
Commit
9b84d58f
authored
Feb 16, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style fix and improved test coverage
parent
80accb1a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
29 deletions
+99
-29
library/Solarium/Client/Response/Select.php
library/Solarium/Client/Response/Select.php
+1
-2
tests/Solarium/Query/Select/Facet/FieldTest.php
tests/Solarium/Query/Select/Facet/FieldTest.php
+27
-9
tests/Solarium/Query/Select/Facet/QueryTest.php
tests/Solarium/Query/Select/Facet/QueryTest.php
+15
-3
tests/Solarium/Query/Select/FacetTest.php
tests/Solarium/Query/Select/FacetTest.php
+30
-6
tests/Solarium/Query/Select/FilterQueryTest.php
tests/Solarium/Query/Select/FilterQueryTest.php
+25
-8
tests/Solarium/Result/Select/Facet/FieldTest.php
tests/Solarium/Result/Select/Facet/FieldTest.php
+1
-1
No files found.
library/Solarium/Client/Response/Select.php
View file @
9b84d58f
...
...
@@ -47,8 +47,7 @@ class Solarium_Client_Response_Select extends Solarium_Client_Response
}
}
foreach
(
$this
->
_query
->
getFacets
()
AS
$facet
)
{
foreach
(
$this
->
_query
->
getFacets
()
AS
$facet
)
{
switch
(
$facet
->
getType
())
{
case
Solarium_Query_Select_Facet
::
FIELD
:
$this
->
_addFacetField
(
$facet
);
...
...
tests/Solarium/Query/Select/Facet/FieldTest.php
View file @
9b84d58f
...
...
@@ -32,48 +32,66 @@
class
Solarium_Query_Select_Facet_FieldTest
extends
PHPUnit_Framework_TestCase
{
protected
$_facet
;
public
function
setUp
()
{
$this
->
_facet
=
new
Solarium_Query_Select_Facet_Field
;
}
public
function
testGetType
()
{
//TODO
$this
->
assertEquals
(
Solarium_Query_Select_Facet
::
FIELD
,
$this
->
_facet
->
getType
()
);
}
public
function
testSetAndGetField
()
{
//TODO
$this
->
_facet
->
setField
(
'category'
);
$this
->
assertEquals
(
'category'
,
$this
->
_facet
->
getField
());
}
public
function
testSetAndGetSort
()
{
//TODO
$this
->
_facet
->
setSort
(
'index'
);
$this
->
assertEquals
(
'index'
,
$this
->
_facet
->
getSort
());
}
public
function
testSetAndGetPrefix
()
{
//TODO
$this
->
_facet
->
setPrefix
(
'xyz'
);
$this
->
assertEquals
(
'xyz'
,
$this
->
_facet
->
getPrefix
());
}
public
function
testSetAndGetLimit
()
{
//TODO
$this
->
_facet
->
setLimit
(
12
);
$this
->
assertEquals
(
12
,
$this
->
_facet
->
getLimit
());
}
public
function
testSetAndGetOffset
()
{
//TODO
$this
->
_facet
->
setOffset
(
40
);
$this
->
assertEquals
(
40
,
$this
->
_facet
->
getOffset
());
}
public
function
testSetAndGetMinCount
()
{
//TODO
$this
->
_facet
->
setMincount
(
100
);
$this
->
assertEquals
(
100
,
$this
->
_facet
->
getMincount
());
}
public
function
testSetAndGetMissing
()
{
//TODO
$this
->
_facet
->
setMissing
(
true
);
$this
->
assertEquals
(
true
,
$this
->
_facet
->
getMissing
());
}
public
function
testSetAndGetMethod
()
{
//TODO
$this
->
_facet
->
setMethod
(
'enum'
);
$this
->
assertEquals
(
'enum'
,
$this
->
_facet
->
getMethod
());
}
}
tests/Solarium/Query/Select/Facet/QueryTest.php
View file @
9b84d58f
...
...
@@ -32,14 +32,26 @@
class
Solarium_Query_Select_Facet_QueryTest
extends
PHPUnit_Framework_TestCase
{
public
function
testSetAndGetQuery
()
protected
$_facet
;
public
function
setUp
()
{
//TODO
$this
->
_facet
=
new
Solarium_Query_Select_Facet_Query
;
}
public
function
testGetType
()
{
//TODO
$this
->
assertEquals
(
Solarium_Query_Select_Facet
::
QUERY
,
$this
->
_facet
->
getType
()
);
}
public
function
testSetAndGetQuery
()
{
$this
->
_facet
->
setQuery
(
'category:1'
);
$this
->
assertEquals
(
'category:1'
,
$this
->
_facet
->
getQuery
());
}
}
tests/Solarium/Query/Select/FacetTest.php
View file @
9b84d58f
...
...
@@ -32,33 +32,57 @@
class
Solarium_Query_Select_FacetTest
extends
PHPUnit_Framework_TestCase
{
protected
$_facet
;
public
function
setUp
()
{
$this
->
_facet
=
new
TestFacet
;
}
public
function
testSetAndGetKey
()
{
//TODO
$this
->
_facet
->
setKey
(
'testkey'
);
$this
->
assertEquals
(
'testkey'
,
$this
->
_facet
->
getKey
());
}
public
function
testAddExclude
()
{
//TODO
$this
->
_facet
->
addExclude
(
'e1'
);
$this
->
assertEquals
(
array
(
'e1'
),
$this
->
_facet
->
getExcludes
());
}
public
function
testAddExcludes
()
{
//TODO
$this
->
_facet
->
addExcludes
(
array
(
'e1'
,
'e2'
));
$this
->
assertEquals
(
array
(
'e1'
,
'e2'
),
$this
->
_facet
->
getExcludes
());
}
public
function
testRemoveExclude
()
{
//TODO
$this
->
_facet
->
addExcludes
(
array
(
'e1'
,
'e2'
));
$this
->
_facet
->
removeExclude
(
'e1'
);
$this
->
assertEquals
(
array
(
'e2'
),
$this
->
_facet
->
getExcludes
());
}
public
function
testClearExcludes
()
{
//TODO
$this
->
_facet
->
addExcludes
(
array
(
'e1'
,
'e2'
));
$this
->
_facet
->
clearExcludes
();
$this
->
assertEquals
(
array
(),
$this
->
_facet
->
getExcludes
());
}
public
function
testSetExcludes
()
{
//TODO
$this
->
_facet
->
addExcludes
(
array
(
'e1'
,
'e2'
));
$this
->
_facet
->
addExcludes
(
array
(
'e3'
,
'e4'
));
$this
->
assertEquals
(
array
(
'e3'
,
'e4'
),
$this
->
_facet
->
getExcludes
());
}
}
class
TestFacet
extends
Solarium_Query_Select_Facet
{
public
function
getType
()
{
return
'test'
;
}
}
\ No newline at end of file
tests/Solarium/Query/Select/FilterQueryTest.php
View file @
9b84d58f
...
...
@@ -32,38 +32,55 @@
class
Solarium_Query_Select_FilterQueryTest
extends
PHPUnit_Framework_TestCase
{
protected
$_filterQuery
;
public
function
setUp
()
{
$this
->
_filterQuery
=
new
Solarium_Query_Select_FilterQuery
;
}
public
function
testSetAndGetKey
()
{
//TODO
$this
->
_filterQuery
->
setKey
(
'testkey'
);
$this
->
assertEquals
(
'testkey'
,
$this
->
_filterQuery
->
getKey
());
}
public
function
testSetAndGetQuery
()
{
//TODO
$this
->
_filterQuery
->
setQuery
(
'category:1'
);
$this
->
assertEquals
(
'category:1'
,
$this
->
_filterQuery
->
getQuery
());
}
public
function
testAddTag
()
{
//TODO
$this
->
_filterQuery
->
addTag
(
'testtag'
);
$this
->
assertEquals
(
array
(
'testtag'
),
$this
->
_filterQuery
->
getTags
());
}
public
function
testAddTags
()
{
//TODO
$this
->
_filterQuery
->
addTags
(
array
(
't1'
,
't2'
));
$this
->
assertEquals
(
array
(
't1'
,
't2'
),
$this
->
_filterQuery
->
getTags
());
}
public
function
testRemoveTag
s
()
public
function
testRemoveTag
()
{
//TODO
$this
->
_filterQuery
->
addTags
(
array
(
't1'
,
't2'
));
$this
->
_filterQuery
->
removeTag
(
't1'
);
$this
->
assertEquals
(
array
(
't2'
),
$this
->
_filterQuery
->
getTags
());
}
public
function
testClearTags
()
{
//TODO
$this
->
_filterQuery
->
addTags
(
array
(
't1'
,
't2'
));
$this
->
_filterQuery
->
clearTags
();
$this
->
assertEquals
(
array
(),
$this
->
_filterQuery
->
getTags
());
}
public
function
testSetTags
()
{
//TODO
$this
->
_filterQuery
->
addTags
(
array
(
't1'
,
't2'
));
$this
->
_filterQuery
->
setTags
(
array
(
't3'
,
't4'
));
$this
->
assertEquals
(
array
(
't3'
,
't4'
),
$this
->
_filterQuery
->
getTags
());
}
}
tests/Solarium/Result/Select/Facet/FieldTest.php
View file @
9b84d58f
...
...
@@ -57,7 +57,7 @@ class Solarium_Result_Select_Facet_FieldTest extends PHPUnit_Framework_TestCase
public
function
testIterator
()
{
$values
=
array
();
foreach
(
$this
->
_facet
->
getValues
()
AS
$key
=>
$value
)
foreach
(
$this
->
_facet
AS
$key
=>
$value
)
{
$values
[
$key
]
=
$value
;
}
...
...
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