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
b9eec0bb
Commit
b9eec0bb
authored
Mar 13, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved unittest coverage
parent
4509519b
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
200 additions
and
30 deletions
+200
-30
library/Solarium/Query/Select/Query/Query.php
library/Solarium/Query/Select/Query/Query.php
+30
-30
tests/Solarium/Tests/Query/Analysis/Query/DocumentTest.php
tests/Solarium/Tests/Query/Analysis/Query/DocumentTest.php
+10
-0
tests/Solarium/Tests/Query/Analysis/Query/FieldTest.php
tests/Solarium/Tests/Query/Analysis/Query/FieldTest.php
+10
-0
tests/Solarium/Tests/Query/MoreLikeThis/QueryTest.php
tests/Solarium/Tests/Query/MoreLikeThis/QueryTest.php
+10
-0
tests/Solarium/Tests/Query/Ping/QueryTest.php
tests/Solarium/Tests/Query/Ping/QueryTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/DebugTest.php
...Solarium/Tests/Query/Select/Query/Component/DebugTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/DisMaxTest.php
...olarium/Tests/Query/Select/Query/Component/DisMaxTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/DistributedSearchTest.php
...ts/Query/Select/Query/Component/DistributedSearchTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/FacetSetTest.php
...arium/Tests/Query/Select/Query/Component/FacetSetTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/GroupingTest.php
...arium/Tests/Query/Select/Query/Component/GroupingTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/Highlighting/HighlightingTest.php
.../Select/Query/Component/Highlighting/HighlightingTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/MoreLikeThisTest.php
...m/Tests/Query/Select/Query/Component/MoreLikeThisTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/SpellcheckTest.php
...ium/Tests/Query/Select/Query/Component/SpellcheckTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/Component/Stats/StatsTest.php
...um/Tests/Query/Select/Query/Component/Stats/StatsTest.php
+10
-0
tests/Solarium/Tests/Query/Select/Query/QueryTest.php
tests/Solarium/Tests/Query/Select/Query/QueryTest.php
+10
-0
tests/Solarium/Tests/Query/Suggester/QueryTest.php
tests/Solarium/Tests/Query/Suggester/QueryTest.php
+10
-0
tests/Solarium/Tests/Query/Terms/QueryTest.php
tests/Solarium/Tests/Query/Terms/QueryTest.php
+10
-0
tests/Solarium/Tests/Query/Update/Query/QueryTest.php
tests/Solarium/Tests/Query/Update/Query/QueryTest.php
+10
-0
No files found.
library/Solarium/Query/Select/Query/Query.php
View file @
b9eec0bb
...
@@ -124,36 +124,6 @@ class Query extends BaseQuery
...
@@ -124,36 +124,6 @@ class Query extends BaseQuery
*/
*/
const
COMPONENT_DEBUG
=
'debug'
;
const
COMPONENT_DEBUG
=
'debug'
;
/**
* Get type for this query
*
* @return string
*/
public
function
getType
()
{
return
Client
::
QUERY_SELECT
;
}
/**
* Get a requestbuilder for this query
*
* @return RequestBuilder
*/
public
function
getRequestBuilder
()
{
return
new
RequestBuilder
;
}
/**
* Get a response parser for this query
*
* @return ResponseParser
*/
public
function
getResponseParser
()
{
return
new
ResponseParser
;
}
/**
/**
* Default options
* Default options
*
*
...
@@ -214,6 +184,36 @@ class Query extends BaseQuery
...
@@ -214,6 +184,36 @@ class Query extends BaseQuery
*/
*/
protected
$components
=
array
();
protected
$components
=
array
();
/**
* Get type for this query
*
* @return string
*/
public
function
getType
()
{
return
Client
::
QUERY_SELECT
;
}
/**
* Get a requestbuilder for this query
*
* @return RequestBuilder
*/
public
function
getRequestBuilder
()
{
return
new
RequestBuilder
;
}
/**
* Get a response parser for this query
*
* @return ResponseParser
*/
public
function
getResponseParser
()
{
return
new
ResponseParser
;
}
/**
/**
* Initialize options
* Initialize options
*
*
...
...
tests/Solarium/Tests/Query/Analysis/Query/DocumentTest.php
View file @
b9eec0bb
...
@@ -51,6 +51,16 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
...
@@ -51,6 +51,16 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_ANALYSIS_DOCUMENT
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_ANALYSIS_DOCUMENT
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Analysis\ResponseParser\Document'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Analysis\RequestBuilder\Document'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testAddAndGetDocument
()
public
function
testAddAndGetDocument
()
{
{
$doc
=
new
Document
(
array
(
'id'
=>
1
));
$doc
=
new
Document
(
array
(
'id'
=>
1
));
...
...
tests/Solarium/Tests/Query/Analysis/Query/FieldTest.php
View file @
b9eec0bb
...
@@ -51,6 +51,16 @@ class FieldTest extends \PHPUnit_Framework_TestCase
...
@@ -51,6 +51,16 @@ class FieldTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_ANALYSIS_FIELD
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_ANALYSIS_FIELD
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Analysis\ResponseParser\Field'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Analysis\RequestBuilder\Field'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testSetAndGetFieldValue
()
public
function
testSetAndGetFieldValue
()
{
{
$data
=
'testdata'
;
$data
=
'testdata'
;
...
...
tests/Solarium/Tests/Query/MoreLikeThis/QueryTest.php
View file @
b9eec0bb
...
@@ -49,6 +49,16 @@ class QueryTest extends SelectQueryTest
...
@@ -49,6 +49,16 @@ class QueryTest extends SelectQueryTest
$this
->
assertEquals
(
Client
::
QUERY_MORELIKETHIS
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_MORELIKETHIS
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\MoreLikeThis\ResponseParser'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\MoreLikeThis\RequestBuilder'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testSetAndGetMatchInclude
()
public
function
testSetAndGetMatchInclude
()
{
{
$value
=
true
;
$value
=
true
;
...
...
tests/Solarium/Tests/Query/Ping/QueryTest.php
View file @
b9eec0bb
...
@@ -48,6 +48,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
...
@@ -48,6 +48,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_PING
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_PING
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertEquals
(
null
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Ping\RequestBuilder'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testConfigMode
()
public
function
testConfigMode
()
{
{
$options
=
array
(
$options
=
array
(
...
...
tests/Solarium/Tests/Query/Select/Query/Component/DebugTest.php
View file @
b9eec0bb
...
@@ -65,6 +65,16 @@ class DebugTest extends \PHPUnit_Framework_TestCase
...
@@ -65,6 +65,16 @@ class DebugTest extends \PHPUnit_Framework_TestCase
);
);
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\Debug'
,
$this
->
debug
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\Debug'
,
$this
->
debug
->
getRequestBuilder
());
}
public
function
testSetAndGetExplainOther
()
public
function
testSetAndGetExplainOther
()
{
{
$value
=
'id:24'
;
$value
=
'id:24'
;
...
...
tests/Solarium/Tests/Query/Select/Query/Component/DisMaxTest.php
View file @
b9eec0bb
...
@@ -83,6 +83,16 @@ class DisMaxTest extends \PHPUnit_Framework_TestCase
...
@@ -83,6 +83,16 @@ class DisMaxTest extends \PHPUnit_Framework_TestCase
);
);
}
}
public
function
testGetResponseParser
()
{
$this
->
assertEquals
(
null
,
$this
->
disMax
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\Dismax'
,
$this
->
disMax
->
getRequestBuilder
());
}
public
function
testSetAndGetQueryParser
()
public
function
testSetAndGetQueryParser
()
{
{
$value
=
'dummyparser'
;
$value
=
'dummyparser'
;
...
...
tests/Solarium/Tests/Query/Select/Query/Component/DistributedSearchTest.php
View file @
b9eec0bb
...
@@ -70,6 +70,16 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
...
@@ -70,6 +70,16 @@ class DistributedSearchTest extends \PHPUnit_Framework_TestCase
);
);
}
}
public
function
testGetResponseParser
()
{
$this
->
assertEquals
(
null
,
$this
->
distributedSearch
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\DistributedSearch'
,
$this
->
distributedSearch
->
getRequestBuilder
());
}
public
function
testAddShard
()
public
function
testAddShard
()
{
{
$this
->
distributedSearch
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
$this
->
distributedSearch
->
addShard
(
'shard1'
,
'localhost:8983/solr/shard1'
);
...
...
tests/Solarium/Tests/Query/Select/Query/Component/FacetSetTest.php
View file @
b9eec0bb
...
@@ -75,6 +75,16 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
...
@@ -75,6 +75,16 @@ class FacetSetTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Query
::
COMPONENT_FACETSET
,
$this
->
facetSet
->
getType
());
$this
->
assertEquals
(
Query
::
COMPONENT_FACETSET
,
$this
->
facetSet
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\FacetSet'
,
$this
->
facetSet
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\FacetSet'
,
$this
->
facetSet
->
getRequestBuilder
());
}
public
function
testSetAndGetSort
()
public
function
testSetAndGetSort
()
{
{
$this
->
facetSet
->
setSort
(
'index'
);
$this
->
facetSet
->
setSort
(
'index'
);
...
...
tests/Solarium/Tests/Query/Select/Query/Component/GroupingTest.php
View file @
b9eec0bb
...
@@ -78,6 +78,16 @@ class GroupingTest extends \PHPUnit_Framework_TestCase
...
@@ -78,6 +78,16 @@ class GroupingTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Query
::
COMPONENT_GROUPING
,
$this
->
grouping
->
getType
());
$this
->
assertEquals
(
Query
::
COMPONENT_GROUPING
,
$this
->
grouping
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\Grouping'
,
$this
->
grouping
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\Grouping'
,
$this
->
grouping
->
getRequestBuilder
());
}
public
function
testSetAndGetFieldsSingle
()
public
function
testSetAndGetFieldsSingle
()
{
{
$value
=
'fieldC'
;
$value
=
'fieldC'
;
...
...
tests/Solarium/Tests/Query/Select/Query/Component/Highlighting/HighlightingTest.php
View file @
b9eec0bb
...
@@ -114,6 +114,16 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
...
@@ -114,6 +114,16 @@ class HighlightingTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Query
::
COMPONENT_HIGHLIGHTING
,
$this
->
hlt
->
getType
());
$this
->
assertEquals
(
Query
::
COMPONENT_HIGHLIGHTING
,
$this
->
hlt
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\Highlighting'
,
$this
->
hlt
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\Highlighting'
,
$this
->
hlt
->
getRequestBuilder
());
}
public
function
testGetFieldAutocreate
()
public
function
testGetFieldAutocreate
()
{
{
$name
=
'test'
;
$name
=
'test'
;
...
...
tests/Solarium/Tests/Query/Select/Query/Component/MoreLikeThisTest.php
View file @
b9eec0bb
...
@@ -79,6 +79,16 @@ class MoreLikeThisTest extends \PHPUnit_Framework_TestCase
...
@@ -79,6 +79,16 @@ class MoreLikeThisTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Query
::
COMPONENT_MORELIKETHIS
,
$this
->
mlt
->
getType
());
$this
->
assertEquals
(
Query
::
COMPONENT_MORELIKETHIS
,
$this
->
mlt
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\MoreLikeThis'
,
$this
->
mlt
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\MoreLikeThis'
,
$this
->
mlt
->
getRequestBuilder
());
}
public
function
testSetAndGetFields
()
public
function
testSetAndGetFields
()
{
{
$value
=
'name,description'
;
$value
=
'name,description'
;
...
...
tests/Solarium/Tests/Query/Select/Query/Component/SpellcheckTest.php
View file @
b9eec0bb
...
@@ -51,6 +51,16 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
...
@@ -51,6 +51,16 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Query
::
COMPONENT_SPELLCHECK
,
$this
->
spellCheck
->
getType
());
$this
->
assertEquals
(
Query
::
COMPONENT_SPELLCHECK
,
$this
->
spellCheck
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\Spellcheck'
,
$this
->
spellCheck
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\Spellcheck'
,
$this
->
spellCheck
->
getRequestBuilder
());
}
public
function
testSetAndGetQuery
()
public
function
testSetAndGetQuery
()
{
{
$value
=
'testquery'
;
$value
=
'testquery'
;
...
...
tests/Solarium/Tests/Query/Select/Query/Component/Stats/StatsTest.php
View file @
b9eec0bb
...
@@ -52,6 +52,16 @@ class StatsTest extends \PHPUnit_Framework_TestCase
...
@@ -52,6 +52,16 @@ class StatsTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Query
::
COMPONENT_STATS
,
$this
->
stats
->
getType
());
$this
->
assertEquals
(
Query
::
COMPONENT_STATS
,
$this
->
stats
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\Component\Stats'
,
$this
->
stats
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\Component\Stats'
,
$this
->
stats
->
getRequestBuilder
());
}
public
function
testConfigMode
()
public
function
testConfigMode
()
{
{
$options
=
array
(
$options
=
array
(
...
...
tests/Solarium/Tests/Query/Select/Query/QueryTest.php
View file @
b9eec0bb
...
@@ -53,6 +53,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
...
@@ -53,6 +53,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_SELECT
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_SELECT
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\ResponseParser\ResponseParser'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Select\RequestBuilder\RequestBuilder'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testSetAndGetStart
()
public
function
testSetAndGetStart
()
{
{
$this
->
query
->
setStart
(
234
);
$this
->
query
->
setStart
(
234
);
...
...
tests/Solarium/Tests/Query/Suggester/QueryTest.php
View file @
b9eec0bb
...
@@ -51,6 +51,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
...
@@ -51,6 +51,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_SUGGESTER
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_SUGGESTER
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Suggester\ResponseParser'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Suggester\RequestBuilder'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testSetAndGetQuery
()
public
function
testSetAndGetQuery
()
{
{
$value
=
'testquery'
;
$value
=
'testquery'
;
...
...
tests/Solarium/Tests/Query/Terms/QueryTest.php
View file @
b9eec0bb
...
@@ -51,6 +51,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
...
@@ -51,6 +51,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_TERMS
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_TERMS
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Terms\ResponseParser'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Terms\RequestBuilder'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testSetAndGetFields
()
public
function
testSetAndGetFields
()
{
{
$this
->
query
->
setFields
(
'fieldA,fieldB'
);
$this
->
query
->
setFields
(
'fieldA,fieldB'
);
...
...
tests/Solarium/Tests/Query/Update/Query/QueryTest.php
View file @
b9eec0bb
...
@@ -51,6 +51,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
...
@@ -51,6 +51,16 @@ class QueryTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
Client
::
QUERY_UPDATE
,
$this
->
query
->
getType
());
$this
->
assertEquals
(
Client
::
QUERY_UPDATE
,
$this
->
query
->
getType
());
}
}
public
function
testGetResponseParser
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Update\ResponseParser'
,
$this
->
query
->
getResponseParser
());
}
public
function
testGetRequestBuilder
()
{
$this
->
assertInstanceOf
(
'Solarium\Query\Update\RequestBuilder'
,
$this
->
query
->
getRequestBuilder
());
}
public
function
testConfigMode
()
public
function
testConfigMode
()
{
{
$options
=
array
(
$options
=
array
(
...
...
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