You are here

protected function SerializerTest::setUp in Drupal 10

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()
  2. 9 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');
}