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
98cac95f
Commit
98cac95f
authored
Mar 23, 2012
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unittests to restore 100% coverage
parent
bb7dc32e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
tests/Solarium/Tests/Core/Client/ClientTest.php
tests/Solarium/Tests/Core/Client/ClientTest.php
+35
-0
No files found.
tests/Solarium/Tests/Core/Client/ClientTest.php
View file @
98cac95f
...
@@ -357,6 +357,20 @@ class ClientTest extends \PHPUnit_Framework_TestCase
...
@@ -357,6 +357,20 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this
->
assertThat
(
$this
->
client
->
getAdapter
(),
$this
->
isInstanceOf
(
$adapterClass
));
$this
->
assertThat
(
$this
->
client
->
getAdapter
(),
$this
->
isInstanceOf
(
$adapterClass
));
}
}
public
function
testSetAndGetAdapterWithInvalidObject
()
{
$this
->
setExpectedException
(
'Solarium\Core\Exception'
);
$this
->
client
->
setAdapter
(
new
\stdClass
());
}
public
function
testSetAndGetAdapterWithInvalidString
()
{
$adapterClass
=
'\\stdClass'
;
$this
->
client
->
setAdapter
(
$adapterClass
);
$this
->
setExpectedException
(
'Solarium\Core\Exception'
);
$this
->
client
->
getAdapter
();
}
public
function
testRegisterQueryTypeAndGetQueryTypes
()
public
function
testRegisterQueryTypeAndGetQueryTypes
()
{
{
$queryTypes
=
$this
->
client
->
getQueryTypes
();
$queryTypes
=
$this
->
client
->
getQueryTypes
();
...
@@ -605,6 +619,20 @@ class ClientTest extends \PHPUnit_Framework_TestCase
...
@@ -605,6 +619,20 @@ class ClientTest extends \PHPUnit_Framework_TestCase
);
);
}
}
public
function
testCreateResultWithInvalidResult
()
{
$overrideValue
=
'\\stdClass'
;
$response
=
new
Response
(
''
,
array
(
'HTTP 1.0 200 OK'
));
$mockQuery
=
$this
->
getMock
(
'Solarium\Query\Select\Query\Query'
,
array
(
'getResultClass'
));
$mockQuery
->
expects
(
$this
->
once
())
->
method
(
'getResultClass'
)
->
will
(
$this
->
returnValue
(
$overrideValue
));
$this
->
setExpectedException
(
'Solarium\Core\Exception'
);
$this
->
client
->
createResult
(
$mockQuery
,
$response
);
}
public
function
testExecute
()
public
function
testExecute
()
{
{
$query
=
new
PingQuery
();
$query
=
new
PingQuery
();
...
@@ -891,6 +919,13 @@ class ClientTest extends \PHPUnit_Framework_TestCase
...
@@ -891,6 +919,13 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this
->
client
->
createQuery
(
'invalidtype'
);
$this
->
client
->
createQuery
(
'invalidtype'
);
}
}
public
function
testCreateQueryWithInvalidClass
()
{
$this
->
client
->
registerQueryType
(
'invalidquery'
,
'\\StdClass'
);
$this
->
setExpectedException
(
'Solarium\Core\Exception'
);
$this
->
client
->
createQuery
(
'invalidquery'
);
}
public
function
testCreateQueryPrePlugin
()
public
function
testCreateQueryPrePlugin
()
{
{
$type
=
Client
::
QUERY_SELECT
;
$type
=
Client
::
QUERY_SELECT
;
...
...
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