public function ViewsSortTest::testOrder in Lightweight Directory Access Protocol (LDAP) 8.4
Tests something.
File
- ldap_query/
tests/ src/ Unit/ ViewsSortTest.php, line 38
Class
- ViewsSortTest
- Test multidimensional sorting.
Namespace
Drupal\Tests\ldap_query\UnitCode
public function testOrder() : void {
$this->view
->addOrderBy(NULL, 'sn', 'asc', 'sn');
$this->view
->addOrderBy(NULL, 'uid', 'desc', 'uid');
$rows = [
[
'cn' => [
'aaaaaaa',
],
'sn' => [
'Granger',
],
'uid' => [
'12345',
],
],
[
'cn' => [
'hgranger',
],
'sn' => [
'Granger',
],
'uid' => [
'12346',
],
],
[
'cn' => [
'adumbledore',
],
'sn' => [
'Dumbledore',
],
'uid' => [
'92345',
],
],
];
$sorted = [
[
'cn' => [
'adumbledore',
],
'sn' => [
'Dumbledore',
],
'uid' => [
'92345',
],
'sort_sn' => 'Dumbledore',
'sort_uid' => '92345',
],
[
'cn' => [
'hgranger',
],
'sn' => [
'Granger',
],
'uid' => [
'12346',
],
'sort_sn' => 'Granger',
'sort_uid' => '12346',
],
[
'cn' => [
'aaaaaaa',
],
'sn' => [
'Granger',
],
'uid' => [
'12345',
],
'sort_uid' => '12345',
'sort_sn' => 'Granger',
],
];
$output = $this->view
->sortResults($rows);
self::assertEquals($sorted, $output);
}