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
4d2e48ff
Commit
4d2e48ff
authored
Aug 12, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added analysis query classes and new unittests for these classes
parent
1ab43733
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
616 additions
and
0 deletions
+616
-0
library/Solarium/Client.php
library/Solarium/Client.php
+40
-0
library/Solarium/Query/Analysis.php
library/Solarium/Query/Analysis.php
+97
-0
library/Solarium/Query/Analysis/Document.php
library/Solarium/Query/Analysis/Document.php
+110
-0
library/Solarium/Query/Analysis/Field.php
library/Solarium/Query/Analysis/Field.php
+137
-0
tests/Solarium/ClientTest.php
tests/Solarium/ClientTest.php
+24
-0
tests/Solarium/Query/Analysis/DocumentTest.php
tests/Solarium/Query/Analysis/DocumentTest.php
+71
-0
tests/Solarium/Query/Analysis/FieldTest.php
tests/Solarium/Query/Analysis/FieldTest.php
+71
-0
tests/Solarium/Query/AnalysisTest.php
tests/Solarium/Query/AnalysisTest.php
+66
-0
No files found.
library/Solarium/Client.php
View file @
4d2e48ff
...
...
@@ -77,6 +77,16 @@ class Solarium_Client extends Solarium_Configurable
*/
const
QUERYTYPE_MORELIKETHIS
=
'mlt'
;
/**
* Querytype analysis field
*/
const
QUERYTYPE_ANALYSIS_FIELD
=
'analysis-field'
;
/**
* Querytype analysis document
*/
const
QUERYTYPE_ANALYSIS_DOCUMENT
=
'analysis-document'
;
/**
* Default options
*
...
...
@@ -112,6 +122,16 @@ class Solarium_Client extends Solarium_Configurable
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_MoreLikeThis'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_MoreLikeThis'
),
self
::
QUERYTYPE_ANALYSIS_DOCUMENT
=>
array
(
'query'
=>
'Solarium_Query_Analysis_Document'
,
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_Analysis_Document'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_Analysis_Document'
),
self
::
QUERYTYPE_ANALYSIS_FIELD
=>
array
(
'query'
=>
'Solarium_Query_Analysis_Field'
,
'requestbuilder'
=>
'Solarium_Client_RequestBuilder_Analysis_Field'
,
'responseparser'
=>
'Solarium_Client_ResponseParser_Analysis_Field'
),
);
/**
...
...
@@ -657,5 +677,25 @@ class Solarium_Client extends Solarium_Configurable
return
$this
->
createQuery
(
self
::
QUERYTYPE_PING
,
$options
);
}
/**
* Create an analysis field query instance
*
* @param mixed $options
* @return Solarium_Query_Analysis_Field
*/
public
function
createAnalysisField
(
$options
=
null
)
{
return
$this
->
createQuery
(
self
::
QUERYTYPE_ANALYSIS_FIELD
,
$options
);
}
/**
* Create an analysis document query instance
*
* @param mixed $options
* @return Solarium_Query_Analysis_Document
*/
public
function
createAnalysisDocument
(
$options
=
null
)
{
return
$this
->
createQuery
(
self
::
QUERYTYPE_ANALYSIS_DOCUMENT
,
$options
);
}
}
library/Solarium/Query/Analysis.php
0 → 100644
View file @
4d2e48ff
<?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.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Query
*/
/**
* Base class for Analysis queries
*
* @package Solarium
* @subpackage Query
*/
abstract
class
Solarium_Query_Analysis
extends
Solarium_Query
{
/**
* Set the query string
*
* When present, the text that will be analyzed. The analysis will mimic the query-time analysis.
*
* @param string $query
* @param array $bind Optional bind values for placeholders in the query string
* @return Solarium_Query_Analysis Provides fluent interface
*/
public
function
setQuery
(
$query
,
$bind
=
null
)
{
if
(
!
is_null
(
$bind
))
{
$query
=
$this
->
getHelper
()
->
assemble
(
$query
,
$bind
);
}
return
$this
->
_setOption
(
'query'
,
trim
(
$query
));
}
/**
* Get the query string
*
* @return string
*/
public
function
getQuery
()
{
return
$this
->
getOption
(
'query'
);
}
/**
* Set the showmatch option
*
* @param boolean $show
* @return Solarium_Query_Analysis Provides fluent interface
*/
public
function
setShowMatch
(
$show
)
{
return
$this
->
_setOption
(
'showmatch'
,
$show
);
}
/**
* Get the showmatch option
*
* @return mixed
*/
public
function
getShowMatch
()
{
return
$this
->
getOption
(
'showmatch'
);
}
}
\ No newline at end of file
library/Solarium/Query/Analysis/Document.php
0 → 100644
View file @
4d2e48ff
<?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.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Query
*/
/**
* Analysis document query
*
* @package Solarium
* @subpackage Query
*/
class
Solarium_Query_Analysis_Document
extends
Solarium_Query_Analysis
{
/**
* Documents to analyze
*
* @var array
*/
protected
$_documents
=
array
();
/**
* Default options
*
* @var array
*/
protected
$_options
=
array
(
'handler'
=>
'analysis'
,
'resultclass'
=>
'Solarium_Result_Analysis_Document'
,
);
/**
* Get type for this query
*
* @return string
*/
public
function
getType
()
{
return
Solarium_Client
::
QUERYTYPE_ANALYSIS_DOCUMENT
;
}
/**
* Add a single document
*
* @param object $document
* @return Solarium_Query_Analysis_Document Provides fluent interface
*/
public
function
addDocument
(
$document
)
{
$this
->
_documents
[]
=
$document
;
return
$this
;
}
/**
* Add multiple documents
*
* @param array $documents
* @return Solarium_Query_Analysis_Document fluent interface
*/
public
function
addDocuments
(
$documents
)
{
$this
->
_documents
=
array_merge
(
$this
->
_documents
,
$documents
);
return
$this
;
}
/**
* Get all documents
*
* @return array
*/
public
function
getDocuments
()
{
return
$this
->
_documents
;
}
}
\ No newline at end of file
library/Solarium/Query/Analysis/Field.php
0 → 100644
View file @
4d2e48ff
<?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.
*
* @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
* @license http://github.com/basdenooijer/solarium/raw/master/COPYING
* @link http://www.solarium-project.org/
*
* @package Solarium
* @subpackage Query
*/
/**
* Analysis document query
*
* @package Solarium
* @subpackage Query
*/
class
Solarium_Query_Analysis_Field
extends
Solarium_Query_Analysis
{
/**
* Default options
*
* @var array
*/
protected
$_options
=
array
(
'handler'
=>
'analysis'
,
'resultclass'
=>
'Solarium_Result_Analysis_Field'
,
);
/**
* Get type for this query
*
* @return string
*/
public
function
getType
()
{
return
Solarium_Client
::
QUERYTYPE_ANALYSIS_FIELD
;
}
/**
* Set the field value option
*
* The text that will be analyzed. The analysis will mimic the index-time analysis.
*
* @param string $value
* @return Solarium_Query_Analysis_Field Provides fluent interface
*/
public
function
setFieldValue
(
$value
)
{
return
$this
->
_setOption
(
'fieldvalue'
,
$value
);
}
/**
* Get the field value option
*
* @return string
*/
public
function
getFieldValue
()
{
return
$this
->
getOption
(
'fieldvalue'
);
}
/**
* Set the field type option
*
* When present, the text will be analyzed based on the specified type
*
* @param string $type
* @return Solarium_Query_Analysis_Field Provides fluent interface
*/
public
function
setFieldType
(
$type
)
{
return
$this
->
_setOption
(
'fieldtype'
,
$type
);
}
/**
* Get the fieldtype option
*
* @return string
*/
public
function
getFieldType
()
{
return
$this
->
getOption
(
'fieldtype'
);
}
/**
* Set the field name option
*
* When present, the text will be analyzed based on the type of this field name
*
* @param string $name
* @return Solarium_Query_Analysis_Field Provides fluent interface
*/
public
function
setFieldName
(
$name
)
{
return
$this
->
_setOption
(
'fieldname'
,
$name
);
}
/**
* Get the fieldname option
*
* @return string
*/
public
function
getFieldName
()
{
return
$this
->
getOption
(
'fieldname'
);
}
}
\ No newline at end of file
tests/Solarium/ClientTest.php
View file @
4d2e48ff
...
...
@@ -735,6 +735,30 @@ class Solarium_ClientTest extends PHPUnit_Framework_TestCase
->
with
(
$this
->
equalTo
(
Solarium_Client
::
QUERYTYPE_MORELIKETHIS
),
$this
->
equalTo
(
$options
));
$observer
->
createMoreLikeThis
(
$options
);
}
public
function
testCreateAnalysisField
()
{
$options
=
array
(
'optionA'
=>
1
,
'optionB'
=>
2
);
$observer
=
$this
->
getMock
(
'Solarium_Client'
,
array
(
'createQuery'
));
$observer
->
expects
(
$this
->
once
())
->
method
(
'createQuery'
)
->
with
(
$this
->
equalTo
(
Solarium_Client
::
QUERYTYPE_ANALYSIS_FIELD
),
$this
->
equalTo
(
$options
));
$observer
->
createAnalysisField
(
$options
);
}
public
function
testCreateAnalysisDocument
()
{
$options
=
array
(
'optionA'
=>
1
,
'optionB'
=>
2
);
$observer
=
$this
->
getMock
(
'Solarium_Client'
,
array
(
'createQuery'
));
$observer
->
expects
(
$this
->
once
())
->
method
(
'createQuery'
)
->
with
(
$this
->
equalTo
(
Solarium_Client
::
QUERYTYPE_ANALYSIS_DOCUMENT
),
$this
->
equalTo
(
$options
));
$observer
->
createAnalysisDocument
(
$options
);
}
}
...
...
tests/Solarium/Query/Analysis/DocumentTest.php
0 → 100644
View file @
4d2e48ff
<?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_Query_Analysis_DocumentTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Query_Analysis_Document
*/
protected
$_query
;
public
function
setUp
()
{
$this
->
_query
=
new
Solarium_Query_Analysis_Document
;
}
public
function
testGetType
()
{
$this
->
assertEquals
(
Solarium_Client
::
QUERYTYPE_ANALYSIS_DOCUMENT
,
$this
->
_query
->
getType
());
}
public
function
testAddAndGetDocument
()
{
$doc
=
new
Solarium_Document_ReadWrite
(
array
(
'id'
=>
1
));
$this
->
_query
->
addDocument
(
$doc
);
$this
->
assertEquals
(
array
(
$doc
),
$this
->
_query
->
getDocuments
()
);
}
public
function
testAddAndGetDocuments
()
{
$doc1
=
new
Solarium_Document_ReadWrite
(
array
(
'id'
=>
1
));
$doc2
=
new
Solarium_Document_ReadWrite
(
array
(
'id'
=>
2
));
$this
->
_query
->
addDocuments
(
array
(
$doc1
,
$doc2
));
$this
->
assertEquals
(
array
(
$doc1
,
$doc2
),
$this
->
_query
->
getDocuments
()
);
}
}
\ No newline at end of file
tests/Solarium/Query/Analysis/FieldTest.php
0 → 100644
View file @
4d2e48ff
<?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_Query_Analysis_FieldTest
extends
PHPUnit_Framework_TestCase
{
/**
* @var Solarium_Query_Analysis_Field
*/
protected
$_query
;
public
function
setUp
()
{
$this
->
_query
=
new
Solarium_Query_Analysis_Field
;
}
public
function
testGetType
()
{
$this
->
assertEquals
(
Solarium_Client
::
QUERYTYPE_ANALYSIS_FIELD
,
$this
->
_query
->
getType
());
}
public
function
testSetAndGetFieldValue
()
{
$data
=
'testdata'
;
$this
->
_query
->
setFieldValue
(
$data
);
$this
->
assertEquals
(
$data
,
$this
->
_query
->
getFieldValue
());
}
public
function
testSetAndGetFieldType
()
{
$data
=
'testdata'
;
$this
->
_query
->
setFieldType
(
$data
);
$this
->
assertEquals
(
$data
,
$this
->
_query
->
getFieldType
());
}
public
function
testSetAndGetFieldName
()
{
$data
=
'testdata'
;
$this
->
_query
->
setFieldName
(
$data
);
$this
->
assertEquals
(
$data
,
$this
->
_query
->
getFieldName
());
}
}
\ No newline at end of file
tests/Solarium/Query/AnalysisTest.php
0 → 100644
View file @
4d2e48ff
<?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_Query_AnalysisTest
extends
PHPUnit_Framework_TestCase
{
protected
$_query
;
public
function
setUp
()
{
$this
->
_query
=
new
TestAnalysisQuery
;
}
public
function
testSetAndGetQuery
()
{
$querystring
=
'test query values'
;
$this
->
_query
->
setQuery
(
$querystring
);
$this
->
assertEquals
(
$querystring
,
$this
->
_query
->
getQuery
());
}
public
function
testSetAndGetShowMatch
()
{
$show
=
true
;
$this
->
_query
->
setShowMatch
(
$show
);
$this
->
assertEquals
(
$show
,
$this
->
_query
->
getShowMatch
());
}
}
class
TestAnalysisQuery
extends
Solarium_Query_Analysis
{
public
function
getType
()
{
}
}
\ No newline at end of file
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