diff --git a/module/VuFind/src/VuFind/AjaxHandler/GetSearchResults.php b/module/VuFind/src/VuFind/AjaxHandler/GetSearchResults.php index 0e3aab244ac..e0cdfd076d2 100644 --- a/module/VuFind/src/VuFind/AjaxHandler/GetSearchResults.php +++ b/module/VuFind/src/VuFind/AjaxHandler/GetSearchResults.php @@ -241,6 +241,7 @@ protected function renderResults(ParamsHelper $requestParams, Results $results): 'showBulkOptions' => $showBulkOptions, 'showCartControls' => $showCartControls, 'showCheckboxes' => $showCheckboxes, + 'saveToHistory' => (bool)$requestParams->fromQuery('history', false), ] ); } diff --git a/module/VuFind/src/VuFindTest/Feature/SearchSortTrait.php b/module/VuFind/src/VuFindTest/Feature/SearchSortTrait.php index b5a920e45d1..d09c0cfc0ea 100644 --- a/module/VuFind/src/VuFindTest/Feature/SearchSortTrait.php +++ b/module/VuFind/src/VuFindTest/Feature/SearchSortTrait.php @@ -80,6 +80,11 @@ protected function assertResultTitles(Element $page, int $count, string $first, $this->assertCount($count, $titles); $this->assertEquals($first, $titles[0]->getText()); $this->assertEquals($last, $titles[$count - 1]->getText()); + // Check that record links contain sid parameter: + $url = $titles[0]->getAttribute('href'); + parse_str(parse_url($url, PHP_URL_QUERY), $urlParams); + $this->assertArrayHasKey('sid', $urlParams); + $this->assertNotEmpty($urlParams['sid']); } /** diff --git a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchSortTest.php b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchSortTest.php index 6cbd53a651f..856be4fa502 100644 --- a/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchSortTest.php +++ b/module/VuFind/tests/integration-tests/src/VuFindTest/Mink/SearchSortTest.php @@ -99,6 +99,11 @@ public function testSortChange(): void $this->assertResultTitles($page, 20, 'Test Publication 20177', 'Test Publication 201738'); // Check that url no longer contains the page parameter: $this->assertStringNotContainsString('&page', $this->getCurrentQueryString()); + + // Change sort back to relevance (first option) and verify: + $this->clickCss($page, $this->sortControlSelector . ' option'); + $this->waitForPageLoad($page); + $this->assertResultTitles($page, 20, 'Test Publication 20001', 'Test Publication 20020'); } /**