function SortTest::parameterProvider

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest::parameterProvider()
  2. 10 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest::parameterProvider()
  3. 11.x core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest::parameterProvider()

Provides a suite of shortcut sort paramaters and their expected expansions.

File

core/modules/jsonapi/tests/src/Unit/Query/SortTest.php, line 50

Class

SortTest
@coversDefaultClass \Drupal\jsonapi\Query\Sort @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Query

Code

public function parameterProvider() {
    return [
        [
            'lorem',
            [
                [
                    'path' => 'lorem',
                    'direction' => 'ASC',
                    'langcode' => NULL,
                ],
            ],
        ],
        [
            '-lorem',
            [
                [
                    'path' => 'lorem',
                    'direction' => 'DESC',
                    'langcode' => NULL,
                ],
            ],
        ],
        [
            '-lorem,ipsum',
            [
                [
                    'path' => 'lorem',
                    'direction' => 'DESC',
                    'langcode' => NULL,
                ],
                [
                    'path' => 'ipsum',
                    'direction' => 'ASC',
                    'langcode' => NULL,
                ],
            ],
        ],
        [
            '-lorem,-ipsum',
            [
                [
                    'path' => 'lorem',
                    'direction' => 'DESC',
                    'langcode' => NULL,
                ],
                [
                    'path' => 'ipsum',
                    'direction' => 'DESC',
                    'langcode' => NULL,
                ],
            ],
        ],
        [
            [
                [
                    'path' => 'lorem',
                    'langcode' => NULL,
                ],
                [
                    'path' => 'ipsum',
                    'langcode' => 'ca',
                ],
                [
                    'path' => 'dolor',
                    'direction' => 'ASC',
                    'langcode' => 'ca',
                ],
                [
                    'path' => 'sit',
                    'direction' => 'DESC',
                    'langcode' => 'ca',
                ],
            ],
            [
                [
                    'path' => 'lorem',
                    'direction' => 'ASC',
                    'langcode' => NULL,
                ],
                [
                    'path' => 'ipsum',
                    'direction' => 'ASC',
                    'langcode' => 'ca',
                ],
                [
                    'path' => 'dolor',
                    'direction' => 'ASC',
                    'langcode' => 'ca',
                ],
                [
                    'path' => 'sit',
                    'direction' => 'DESC',
                    'langcode' => 'ca',
                ],
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.