You are here

public function SortTest::parameterProvider in Drupal 9

Same name and namespace in other branches
  1. 8 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 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',
        ],
      ],
    ],
  ];
}