From 1f34e5a0706a3576f754833613e8f63e6ca8cca5 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 10 Jan 2014 12:54:10 -0500 Subject: [PATCH] Added test. --- .../src/VuFindTest/Record/LoaderTest.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php index 39ade403878..25c576ce23d 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/Record/LoaderTest.php @@ -65,6 +65,41 @@ class LoaderTest extends TestCase $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. * -- GitLab