Skip to content
Snippets Groups Projects
Commit c7ea1727 authored by Demian Katz's avatar Demian Katz
Browse files

Coverage improvement.

parent c8777731
Branches
Tags
No related merge requests found
...@@ -217,16 +217,54 @@ class BackendTest extends PHPUnit_Framework_TestCase ...@@ -217,16 +217,54 @@ class BackendTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Test refining an alphabrowse exception. * Test refining an alphabrowse exception (string 1).
* *
* @return void * @return void
* @expectedException VuFindSearch\Backend\Exception\RemoteErrorException * @expectedException VuFindSearch\Backend\Exception\RemoteErrorException
* @expectedExceptionMessage Alphabetic Browse index missing. * @expectedExceptionMessage Alphabetic Browse index missing.
*/ */
public function testRefineAlphaBrowseException() public function testRefineAlphaBrowseException()
{
$this->runRefineExceptionCall('does not exist');
}
/**
* Test refining an alphabrowse exception (string 2).
*
* @return void
* @expectedException VuFindSearch\Backend\Exception\RemoteErrorException
* @expectedExceptionMessage Alphabetic Browse index missing.
*/
public function testRefineAlphaBrowseExceptionWithAltString()
{
$this->runRefineExceptionCall('couldn\'t find a browse index');
}
/**
* Test that we don't refine a non-alphabrowse-related exception.
*
* @return void
* @expectedException VuFindSearch\Backend\Exception\RemoteErrorException
* @expectedExceptionMessage not a browse error
*/
public function testRefineAlphaBrowseExceptionWithNonBrowseString()
{
$this->runRefineExceptionCall('not a browse error');
}
/// Internal API
/**
* Support method to run a "refine exception" test.
*
* @param string $msg Error message
*
* @return void
*/
protected function runRefineExceptionCall($msg)
{ {
$conn = $this->getConnectorMock(array('query')); $conn = $this->getConnectorMock(array('query'));
$e = new RemoteErrorException('does not exist', 400, new \Zend\Http\Response()); $e = new RemoteErrorException($msg, 400, new \Zend\Http\Response());
$conn->expects($this->once())->method('query') $conn->expects($this->once())->method('query')
->with($this->equalTo('browse')) ->with($this->equalTo('browse'))
->will($this->throwException($e)); ->will($this->throwException($e));
...@@ -234,8 +272,6 @@ class BackendTest extends PHPUnit_Framework_TestCase ...@@ -234,8 +272,6 @@ class BackendTest extends PHPUnit_Framework_TestCase
$back->alphabeticBrowse('foo', 'bar', 1); $back->alphabeticBrowse('foo', 'bar', 1);
} }
/// Internal API
/** /**
* Load a SOLR response as fixture. * Load a SOLR response as fixture.
* *
......
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