public function WebformViewsSortTestBase::testSort in Webform Views Integration 8.5
Test sorting handler.
@dataProvider providerSort()
Parameters
string $order: Direction of sorting. Allowed values are:
- ASC: to sort ascending.
- DESC: to sort descending.
array $expected: Expected output from $this->renderView() with the specified above sorting.
File
- tests/
src/ Kernel/ sort/ WebformViewsSortTestBase.php, line 25
Class
- WebformViewsSortTestBase
- Reasonable starting point for testing webform views sort handlers.
Namespace
Drupal\Tests\webform_views\Kernel\sortCode
public function testSort($order, $expected) {
$this->webform = $this
->createWebform($this->webform_elements);
$this
->createWebformSubmissions($this->webform_submissions_data, $this->webform);
$view_handlers = $this->view_handlers;
$view_handlers['sort'][0]['options']['order'] = $order;
$this->view = $this
->initView($this->webform, $view_handlers);
$rendered_cells = $this
->renderView($this->view);
$this
->assertSame($expected, $rendered_cells, 'Sorting works for ' . $order . ' order');
}