You are here

protected function RequestHandlerTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rest/tests/src/Kernel/RequestHandlerTest.php \Drupal\Tests\rest\Kernel\RequestHandlerTest::setUp()
  2. 9 core/modules/rest/tests/src/Kernel/RequestHandlerTest.php \Drupal\Tests\rest\Kernel\RequestHandlerTest::setUp()

File

core/modules/rest/tests/src/Kernel/RequestHandlerTest.php, line 43

Class

RequestHandlerTest
Test REST RequestHandler controller logic.

Namespace

Drupal\Tests\rest\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $serializer = $this
    ->prophesize(SerializerInterface::class);
  $serializer
    ->willImplement(DecoderInterface::class);
  $serializer
    ->decode(Json::encode([
    'this is an array',
  ]), 'json', Argument::type('array'))
    ->willReturn([
    'this is an array',
  ]);
  $this->requestHandler = new RequestHandler($serializer
    ->reveal());
}