function SortTest::parameterProvider

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest::parameterProvider()
  2. 8.9.x 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 parameters and their expected expansions.

File

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

Class

SortTest
@coversDefaultClass \Drupal\jsonapi\Query\Sort[[api-linebreak]] @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Query

Code

public static 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.