public function testTableSort() { $header =
[ ['data' => 'ID', 'specifier' => 'id'
],
['data' => 'Number', 'specifier' => 'number'
],
];
// Sort key: id
// Sorting with 'DESC' upper case
$this->queryResults =
$this->entityStorage->
getQuery() ->
tableSort($header) ->
sort('id', 'DESC'
) ->
execute();
$this->
assertSame(['7', '6', '5', '4', '3', '2', '1'
],
array_values($this->queryResults
));
// Sorting with 'ASC' upper case
$this->queryResults =
$this->entityStorage->
getQuery() ->
tableSort($header) ->
sort('id', 'ASC'
) ->
execute();
$this->
assertSame(['1', '2', '3', '4', '5', '6', '7'
],
array_values($this->queryResults
));