You are here

public function EntityConditionGroupNormalizerTest::testDenormalize in JSON:API 8

@covers ::denormalize @dataProvider denormalizeProvider

File

tests/src/Kernel/Normalizer/EntityConditionGroupNormalizerTest.php, line 31

Class

EntityConditionGroupNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\EntityConditionGroupNormalizer @group jsonapi @group jsonapi_normalizers @group legacy

Namespace

Drupal\Tests\jsonapi\Kernel\Normalizer

Code

public function testDenormalize($case) {
  $normalizer = $this->container
    ->get('serializer.normalizer.entity_condition_group.jsonapi');
  $normalized = $normalizer
    ->denormalize($case, EntityConditionGroup::class);
  $this
    ->assertEquals($case['conjunction'], $normalized
    ->conjunction());
  foreach ($normalized
    ->members() as $key => $condition) {
    $this
      ->assertEquals($case['members'][$key]['path'], $condition
      ->field());
    $this
      ->assertEquals($case['members'][$key]['value'], $condition
      ->value());
  }
}