function FilterTest::testCreateFromQueryParameter

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

@covers ::createFromQueryParameter @dataProvider parameterProvider

File

core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php, line 313

Class

FilterTest
@coversDefaultClass \Drupal\jsonapi\Query\Filter @group jsonapi @group jsonapi_query

Namespace

Drupal\Tests\jsonapi\Kernel\Query

Code

public function testCreateFromQueryParameter($case, $expected) {
    $resource_type = new ResourceType('foo', 'bar', NULL);
    $actual = Filter::createFromQueryParameter($case, $resource_type, $this->getFieldResolverMock($resource_type));
    $conditions = $actual->root()
        ->members();
    for ($i = 0; $i < count($case); $i++) {
        $this->assertEquals($expected[$i]['path'], $conditions[$i]->field());
        $this->assertEquals($expected[$i]['value'], $conditions[$i]->value());
        $this->assertEquals($expected[$i]['operator'], $conditions[$i]->operator());
    }
}

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