Commit 98cac95f authored by Bas de Nooijer's avatar Bas de Nooijer

Fixed unittests to restore 100% coverage

parent bb7dc32e
...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment