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
906c76b6
Commit
906c76b6
authored
Nov 30, 2015
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored setting name and added testcases
parent
c5377c36
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
4 deletions
+51
-4
library/Solarium/QueryType/Select/Query/Component/Facet/Field.php
...Solarium/QueryType/Select/Query/Component/Facet/Field.php
+2
-2
library/Solarium/QueryType/Select/Query/Component/FacetSet.php
...ry/Solarium/QueryType/Select/Query/Component/FacetSet.php
+2
-2
tests/Solarium/Tests/QueryType/Select/Query/Component/Facet/FieldTest.php
...ests/QueryType/Select/Query/Component/Facet/FieldTest.php
+16
-0
tests/Solarium/Tests/QueryType/Select/Query/Component/FacetSetTest.php
...m/Tests/QueryType/Select/Query/Component/FacetSetTest.php
+4
-0
tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/FacetSetTest.php
...ueryType/Select/RequestBuilder/Component/FacetSetTest.php
+27
-0
No files found.
library/Solarium/QueryType/Select/Query/Component/Facet/Field.php
View file @
906c76b6
...
@@ -192,7 +192,7 @@ class Field extends AbstractFacet
...
@@ -192,7 +192,7 @@ class Field extends AbstractFacet
*/
*/
public
function
setContainsIgnoreCase
(
$containsIgnoreCase
)
public
function
setContainsIgnoreCase
(
$containsIgnoreCase
)
{
{
return
$this
->
setOption
(
'contains
.ignoreC
ase'
,
$containsIgnoreCase
);
return
$this
->
setOption
(
'contains
ignorec
ase'
,
$containsIgnoreCase
);
}
}
/**
/**
...
@@ -204,7 +204,7 @@ class Field extends AbstractFacet
...
@@ -204,7 +204,7 @@ class Field extends AbstractFacet
*/
*/
public
function
getContainsIgnoreCase
()
public
function
getContainsIgnoreCase
()
{
{
return
$this
->
getOption
(
'contains
.ignoreC
ase'
);
return
$this
->
getOption
(
'contains
ignorec
ase'
);
}
}
/**
/**
...
...
library/Solarium/QueryType/Select/Query/Component/FacetSet.php
View file @
906c76b6
...
@@ -227,7 +227,7 @@ class FacetSet extends AbstractComponent
...
@@ -227,7 +227,7 @@ class FacetSet extends AbstractComponent
*/
*/
public
function
setContainsIgnoreCase
(
$containsIgnoreCase
)
public
function
setContainsIgnoreCase
(
$containsIgnoreCase
)
{
{
return
$this
->
setOption
(
'contains
.ignoreC
ase'
,
$containsIgnoreCase
);
return
$this
->
setOption
(
'contains
ignorec
ase'
,
$containsIgnoreCase
);
}
}
/**
/**
...
@@ -239,7 +239,7 @@ class FacetSet extends AbstractComponent
...
@@ -239,7 +239,7 @@ class FacetSet extends AbstractComponent
*/
*/
public
function
getContainsIgnoreCase
()
public
function
getContainsIgnoreCase
()
{
{
return
$this
->
getOption
(
'contains
.ignoreC
ase'
);
return
$this
->
getOption
(
'contains
ignorec
ase'
);
}
}
/**
/**
...
...
tests/Solarium/Tests/QueryType/Select/Query/Component/Facet/FieldTest.php
View file @
906c76b6
...
@@ -58,6 +58,8 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -58,6 +58,8 @@ class FieldTest extends \PHPUnit_Framework_TestCase
'mincount'
=>
5
,
'mincount'
=>
5
,
'missing'
=>
true
,
'missing'
=>
true
,
'method'
=>
'enum'
,
'method'
=>
'enum'
,
'contains'
=>
'foobar'
,
'containsignorecase'
=>
true
,
);
);
$this
->
facet
->
setOptions
(
$options
);
$this
->
facet
->
setOptions
(
$options
);
...
@@ -71,6 +73,8 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -71,6 +73,8 @@ class FieldTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$options
[
'mincount'
],
$this
->
facet
->
getMinCount
());
$this
->
assertEquals
(
$options
[
'mincount'
],
$this
->
facet
->
getMinCount
());
$this
->
assertEquals
(
$options
[
'missing'
],
$this
->
facet
->
getMissing
());
$this
->
assertEquals
(
$options
[
'missing'
],
$this
->
facet
->
getMissing
());
$this
->
assertEquals
(
$options
[
'method'
],
$this
->
facet
->
getMethod
());
$this
->
assertEquals
(
$options
[
'method'
],
$this
->
facet
->
getMethod
());
$this
->
assertEquals
(
$options
[
'contains'
],
$this
->
facet
->
getContains
());
$this
->
assertEquals
(
$options
[
'containsignorecase'
],
$this
->
facet
->
getContainsIgnoreCase
());
}
}
public
function
testGetType
()
public
function
testGetType
()
...
@@ -128,4 +132,16 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -128,4 +132,16 @@ class FieldTest extends \PHPUnit_Framework_TestCase
$this
->
facet
->
setMethod
(
'enum'
);
$this
->
facet
->
setMethod
(
'enum'
);
$this
->
assertEquals
(
'enum'
,
$this
->
facet
->
getMethod
());
$this
->
assertEquals
(
'enum'
,
$this
->
facet
->
getMethod
());
}
}
public
function
testSetAndGetContains
()
{
$this
->
facet
->
setContains
(
'foobar'
);
$this
->
assertEquals
(
'foobar'
,
$this
->
facet
->
getContains
());
}
public
function
testSetAndGetContainsIgnoreCase
()
{
$this
->
facet
->
setContainsIgnoreCase
(
true
);
$this
->
assertEquals
(
true
,
$this
->
facet
->
getContainsIgnoreCase
());
}
}
}
tests/Solarium/Tests/QueryType/Select/Query/Component/FacetSetTest.php
View file @
906c76b6
...
@@ -59,6 +59,8 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
...
@@ -59,6 +59,8 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
'mincount'
=>
10
,
'mincount'
=>
10
,
'missing'
=>
5
,
'missing'
=>
5
,
'extractfromresponse'
=>
true
,
'extractfromresponse'
=>
true
,
'contains'
=>
'foobar'
,
'containsignorecase'
=>
true
,
);
);
$this
->
facetSet
->
setOptions
(
$options
);
$this
->
facetSet
->
setOptions
(
$options
);
...
@@ -70,6 +72,8 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
...
@@ -70,6 +72,8 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$options
[
'mincount'
],
$this
->
facetSet
->
getMincount
());
$this
->
assertEquals
(
$options
[
'mincount'
],
$this
->
facetSet
->
getMincount
());
$this
->
assertEquals
(
$options
[
'missing'
],
$this
->
facetSet
->
getMissing
());
$this
->
assertEquals
(
$options
[
'missing'
],
$this
->
facetSet
->
getMissing
());
$this
->
assertEquals
(
$options
[
'extractfromresponse'
],
$this
->
facetSet
->
getExtractFromResponse
());
$this
->
assertEquals
(
$options
[
'extractfromresponse'
],
$this
->
facetSet
->
getExtractFromResponse
());
$this
->
assertEquals
(
$options
[
'contains'
],
$this
->
facetSet
->
getContains
());
$this
->
assertEquals
(
$options
[
'containsignorecase'
],
$this
->
facetSet
->
getContainsIgnoreCase
());
}
}
public
function
testGetType
()
public
function
testGetType
()
...
...
tests/Solarium/Tests/QueryType/Select/RequestBuilder/Component/FacetSetTest.php
View file @
906c76b6
...
@@ -232,6 +232,33 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
...
@@ -232,6 +232,33 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
urldecode
(
$request
->
getUri
())
urldecode
(
$request
->
getUri
())
);
);
}
}
public
function
testBuildWithContainsSettings
()
{
$facet
=
new
FacetField
(
array
(
'key'
=>
'f1'
,
'field'
=>
'owner'
,
'contains'
=>
'foo'
,
'containsignorecase'
=>
true
,
)
);
$this
->
component
->
addFacet
(
$facet
);
$this
->
component
->
setContains
(
'bar'
);
$this
->
component
->
setContainsIgnoreCase
(
false
);
$request
=
$this
->
builder
->
buildComponent
(
$this
->
component
,
$this
->
request
);
$this
->
assertEquals
(
null
,
$request
->
getRawData
()
);
$this
->
assertEquals
(
'?facet=true&facet.contains=bar&facet.contains.ignoreCase=false&facet.field={!key=f1}owner&f.owner.facet.contains=foo&f.owner.facet.contains.ignoreCase=true'
,
urldecode
(
$request
->
getUri
())
);
}
}
}
class
UnknownFacet
extends
FacetField
class
UnknownFacet
extends
FacetField
...
...
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