You are here

public function RequestHandlerTest::setUp in Drupal 8

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

Overrides KernelTestBase::setUp

File

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

Class

RequestHandlerTest
Test REST RequestHandler controller logic.

Namespace

Drupal\Tests\rest\Kernel

Code

public function setUp() {
  parent::setUp();
  $config_factory = $this
    ->prophesize(ConfigFactoryInterface::class);
  $config_factory
    ->get('rest.settings')
    ->willReturn($this
    ->prophesize(ImmutableConfig::class)
    ->reveal());
  $serializer = $this
    ->prophesize(SerializerInterface::class);
  $serializer
    ->willImplement(DecoderInterface::class);
  $serializer
    ->decode(Json::encode([
    'this is an array',
  ]), NULL, Argument::type('array'))
    ->willReturn([
    'this is an array',
  ]);
  $this->requestHandler = new RequestHandler($config_factory
    ->reveal(), $serializer
    ->reveal());
}