diff --git a/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php b/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php index be9a7515eee499870394a2381a3838a8077f26b7..a8fdf54ed80ecf473d37a0638e2590f3cc91d577 100644 --- a/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php +++ b/module/VuFind/src/VuFind/Recommend/EuropeanaResults.php @@ -233,7 +233,7 @@ class EuropeanaResults implements RecommendInterface, $resultsProcessed[] = [ 'title' => $value->getTitle(), 'link' => $link, - 'enclosure' => $value->getEnclosure()['url'] + 'enclosure' => $value->getEnclosure()['url'] ?? null ]; } if (count($resultsProcessed) == $this->limit) { diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php index a40b62396ae9802a63c9d8dbb3110c0f31ac6ccc..98c3676a86f9629489484c4f465c5bd1af3354fd 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordDataFormatterTest.php @@ -41,6 +41,22 @@ use VuFind\View\Helper\Root\RecordDataFormatterFactory; */ class RecordDataFormatterTest extends \VuFindTest\Unit\ViewHelperTestCase { + /** + * Get a mock record router. + * + * @return \VuFind\Record\Router + */ + protected function getMockRecordRouter() + { + $mock = $this->getMockBuilder(\VuFind\Record\Router::class) + ->disableOriginalConstructor() + ->setMethods(['getActionRouteDetails']) + ->getMock(); + $mock->expects($this->any())->method('getActionRouteDetails') + ->will($this->returnValue(['route' => 'home', 'params' => []])); + return $mock; + } + /** * Get view helpers needed by test. * @@ -59,7 +75,7 @@ class RecordDataFormatterTest extends \VuFindTest\Unit\ViewHelperTestCase 'openUrl' => new \VuFind\View\Helper\Root\OpenUrl($context, [], $this->getMockBuilder(\VuFind\Resolver\Driver\PluginManager::class)->disableOriginalConstructor()->getMock()), 'proxyUrl' => new \VuFind\View\Helper\Root\ProxyUrl(), 'record' => new \VuFind\View\Helper\Root\Record(), - 'recordLink' => new \VuFind\View\Helper\Root\RecordLink($this->getMockBuilder(\VuFind\Record\Router::class)->disableOriginalConstructor()->getMock()), + 'recordLink' => new \VuFind\View\Helper\Root\RecordLink($this->getMockRecordRouter()), 'searchOptions' => new \VuFind\View\Helper\Root\SearchOptions(new \VuFind\Search\Options\PluginManager($this->getServiceManager())), 'searchTabs' => $this->getMockBuilder(\VuFind\View\Helper\Root\SearchTabs::class)->disableOriginalConstructor()->getMock(), 'transEsc' => new \VuFind\View\Helper\Root\TransEsc(),