public function ViewsTest::testViewSorts in Search API 8
Tests results are ordered correctly and react to exposed sorts.
File
- tests/
src/ Functional/ ViewsTest.php, line 638
Class
- ViewsTest
- Tests the Views integration of the Search API.
Namespace
Drupal\Tests\search_api\FunctionalCode
public function testViewSorts() {
// Check default ordering, first exposed sort in config is
// search_api_relevance.
$this
->checkResultsOrder([], [
1,
2,
3,
4,
5,
]);
// Make sure the exposed sort works.
$query = [
'sort_by' => 'search_api_id_desc',
];
$this
->checkResultsOrder($query, [
5,
4,
3,
2,
1,
]);
}