You are here

protected function SerializerTest::setUp in Drupal 9

Same name in this branch
  1. 9 core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php \Drupal\Tests\jsonapi\Kernel\Serializer\SerializerTest::setUp()
  2. 9 core/modules/rest/tests/src/Unit/Plugin/views/style/SerializerTest.php \Drupal\Tests\rest\Unit\Plugin\views\style\SerializerTest::setUp()
Same name and namespace in other branches
  1. 8 core/modules/rest/tests/src/Unit/Plugin/views/style/SerializerTest.php \Drupal\Tests\rest\Unit\Plugin\views\style\SerializerTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/rest/tests/src/Unit/Plugin/views/style/SerializerTest.php, line 35

Class

SerializerTest
@coversDefaultClass \Drupal\rest\Plugin\views\style\Serializer @group rest

Namespace

Drupal\Tests\rest\Unit\Plugin\views\style

Code

protected function setUp() : void {
  parent::setUp();
  $this->view = $this
    ->getMockBuilder(ViewExecutable::class)
    ->disableOriginalConstructor()
    ->getMock();

  // Make the view result empty so we don't have to mock the row plugin render
  // call.
  $this->view->result = [];
  $this->displayHandler = $this
    ->getMockBuilder(RestExport::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->displayHandler
    ->expects($this
    ->any())
    ->method('getContentType')
    ->willReturn('json');
}