function ViewsModerationStateSortTest::assertSortResults
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::assertSortResults()
- 10 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::assertSortResults()
- 11.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateSortTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateSortTest::assertSortResults()
Assert the order of a views sort result.
Parameters
string $view_id: The ID of the view.
string $column: The column associated with each row.
string $order: The sort order.
array $expected: The expected results array.
2 calls to ViewsModerationStateSortTest::assertSortResults()
- ViewsModerationStateSortTest::testSortBaseTable in core/
modules/ content_moderation/ tests/ src/ Kernel/ ViewsModerationStateSortTest.php - Test sorting with a standard data base table.
- ViewsModerationStateSortTest::testSortRevisionBaseTable in core/
modules/ content_moderation/ tests/ src/ Kernel/ ViewsModerationStateSortTest.php - Test sorting with the revision base table.
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ ViewsModerationStateSortTest.php, line 169
Class
- ViewsModerationStateSortTest
- Tests the views moderation_state field sorting integration.
Namespace
Drupal\Tests\content_moderation\KernelCode
protected function assertSortResults($view_id, $column, $order, array $expected) {
// Test with exposed input.
$view = Views::getView($view_id);
$view->setExposedInput([
'sort_by' => 'moderation_state',
'sort_order' => $order,
]);
$view->execute();
$this->assertIdenticalResultset($view, $expected, [
$column => $column,
]);
// Test click sorting.
$view = Views::getView($view_id);
$view->removeHandler('default', 'sort', 'moderation_state');
$request = new Request([
'order' => 'moderation_state',
'sort' => strtolower($order),
]);
$view->setRequest($request);
$view->execute();
$this->assertIdenticalResultset($view, $expected, [
$column => $column,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.