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

Added test.

parent dd5c3b0f
No related merge requests found
...@@ -65,6 +65,41 @@ class LoaderTest extends TestCase ...@@ -65,6 +65,41 @@ class LoaderTest extends TestCase
$loader->load('test'); $loader->load('test');
} }
/**
* Test single record.
*
* @return void
*/
public function testSingleRecord()
{
$driver = $this->getDriver();
$collection = $this->getCollection(array($driver));
$service = $this->getMock('VuFindSearch\Service');
$service->expects($this->once())->method('retrieve')
->with($this->equalTo('VuFind'), $this->equalTo('test'))
->will($this->returnValue($collection));
$loader = $this->getLoader($service);
$this->assertEquals($driver, $loader->load('test'));
}
/**
* Get test record driver object
*
* @param string $id Record ID
* @param string $source Record source
*
* @return RecordDriver
*/
protected function getDriver($id = 'test', $source = 'VuFind')
{
$driver = $this->getMock('VuFind\RecordDriver\AbstractBase');
$driver->expects($this->any())->method('getUniqueId')
->will($this->returnValue($id));
$driver->expects($this->any())->method('getResourceSource')
->will($this->returnValue($source));
return $driver;
}
/** /**
* Build a loader to test. * Build a loader to test.
* *
......
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