You are here

protected function BlueprintManagerTest::setUp in Subrequests 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Unit/Blueprint/BlueprintManagerTest.php \Drupal\Tests\subrequests\Unit\Blueprint\BlueprintManagerTest::setUp()

Overrides UnitTestCase::setUp

File

tests/src/Unit/Blueprint/BlueprintManagerTest.php, line 28

Class

BlueprintManagerTest
@coversDefaultClass \Drupal\subrequests\Blueprint\BlueprintManager @group subrequests

Namespace

Drupal\Tests\subrequests\Unit\Blueprint

Code

protected function setUp() {
  parent::setUp();
  $denormalizer = $this
    ->prophesize(JsonBlueprintDenormalizer::class);
  $denormalizer
    ->denormalize(Argument::type('array'), SubrequestsTree::class, 'json', [])
    ->willReturn(new SubrequestsTree());
  $denormalizer
    ->supportsDenormalization(Argument::type('array'), SubrequestsTree::class, 'json')
    ->willReturn([])
    ->willReturn(TRUE);

  // Modern versions of Symfony added an extra parameter.
  $denormalizer
    ->supportsDenormalization(Argument::type('array'), SubrequestsTree::class, 'json', Argument::type('array'))
    ->willReturn([])
    ->willReturn(TRUE);
  $denormalizer
    ->setSerializer(Argument::any())
    ->willReturn(NULL);
  $normalizer = $this
    ->prophesize(MultiresponseNormalizer::class);
  $normalizer
    ->normalize(Argument::type('array'), 'multipart-related', Argument::type('array'))
    ->willReturn([
    'content' => 'Booh!',
    'headers' => [
      'head' => 'Ha!',
    ],
  ]);
  $normalizer
    ->supportsNormalization(Argument::type('array'), 'multipart-related')
    ->willReturn([])
    ->willReturn(TRUE);
  $normalizer
    ->supportsNormalization(Argument::type('array'), 'multipart-related', Argument::type('array'))
    ->willReturn([])
    ->willReturn(TRUE);
  $serializer = new Serializer([
    $denormalizer
      ->reveal(),
    $normalizer
      ->reveal(),
  ], [
    new JsonDecode(),
  ]);
  $this->sut = new BlueprintManager($serializer);
}