function SortTest::testCreateFromQueryParameter

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

@covers ::createFromQueryParameter @dataProvider parameterProvider

File

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

Class

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

Namespace

Drupal\Tests\jsonapi\Unit\Query

Code

public function testCreateFromQueryParameter($input, $expected) {
    $sort = Sort::createFromQueryParameter($input);
    foreach ($sort->fields() as $index => $sort_field) {
        $this->assertEquals($expected[$index]['path'], $sort_field['path']);
        $this->assertEquals($expected[$index]['direction'], $sort_field['direction']);
        $this->assertEquals($expected[$index]['langcode'], $sort_field['langcode']);
    }
}

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