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

Fix bug: record data caching was not working.

parent 4230cb6d
No related merge requests found
......@@ -178,7 +178,7 @@ class RecordDataFormatter extends AbstractHelper
return $method;
}
$useCache = isset($options['cacheData']) && $options['cacheData'];
$useCache = isset($options['useCache']) && $options['useCache'];
if ($useCache) {
$cacheKey = $driver->getUniqueID() . '|'
......
......@@ -92,8 +92,11 @@ class RecordDataFormatterTest extends \VuFindTest\Unit\ViewHelperTestCase
protected function getDriver($overrides = [])
{
// "Mock out" tag functionality to avoid database access:
$methods = [
'getBuilding', 'getDeduplicatedAuthors', 'getContainerTitle', 'getTags'
];
$record = $this->getMockBuilder('VuFind\RecordDriver\SolrDefault')
->setMethods(['getBuilding', 'getContainerTitle', 'getTags'])
->setMethods($methods)
->getMock();
$record->expects($this->any())->method('getTags')
->will($this->returnValue([]));
......@@ -103,6 +106,15 @@ class RecordDataFormatterTest extends \VuFindTest\Unit\ViewHelperTestCase
->will($this->returnValue(0));
$record->expects($this->any())->method('getContainerTitle')
->will($this->returnValue('0'));
// Expect only one call to getDeduplicatedAuthors to confirm that caching
// works correctly (we need this data more than once, but should only pull
// it from the driver once).
$authors = [
'primary' => ['Vico, Giambattista, 1668-1744.' => []],
'secondary' => ['Pandolfi, Claudia.' => []],
];
$record->expects($this->once())->method('getDeduplicatedAuthors')
->will($this->returnValue($authors));
// Load record data from fixture file:
$fixture = json_decode(
......
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