You are here

public function JsonApiParamEnhancerTest::getMockNormalizers in JSON:API 8

Builds mock normalizers.

3 calls to JsonApiParamEnhancerTest::getMockNormalizers()
JsonApiParamEnhancerTest::testApplies in tests/src/Unit/Routing/JsonApiParamEnhancerTest.php
@covers ::applies
JsonApiParamEnhancerTest::testEnhancePage in tests/src/Unit/Routing/JsonApiParamEnhancerTest.php
@covers ::enhance
JsonApiParamEnhancerTest::testEnhanceSort in tests/src/Unit/Routing/JsonApiParamEnhancerTest.php
@covers ::enhance

File

tests/src/Unit/Routing/JsonApiParamEnhancerTest.php, line 79

Class

JsonApiParamEnhancerTest
@coversDefaultClass \Drupal\jsonapi\Routing\JsonApiParamEnhancer @group jsonapi @group jsonapi_param_enhancer @group legacy

Namespace

Drupal\Tests\jsonapi\Unit\Routing

Code

public function getMockNormalizers() {
  $filter_normalizer = $this
    ->prophesize(DenormalizerInterface::class);
  $filter_normalizer
    ->denormalize(Argument::any(), Filter::class, Argument::any(), Argument::any())
    ->willReturn($this
    ->prophesize(Filter::class)
    ->reveal());
  $sort_normalizer = $this
    ->prophesize(DenormalizerInterface::class);
  $sort_normalizer
    ->denormalize(Argument::any(), Sort::class, Argument::any(), Argument::any())
    ->willReturn($this
    ->prophesize(Sort::class)
    ->reveal());
  $page_normalizer = $this
    ->prophesize(DenormalizerInterface::class);
  $page_normalizer
    ->denormalize(Argument::any(), OffsetPage::class)
    ->willReturn($this
    ->prophesize(OffsetPage::class)
    ->reveal());
  return [
    $filter_normalizer
      ->reveal(),
    $sort_normalizer
      ->reveal(),
    $page_normalizer
      ->reveal(),
  ];
}