function SerializerTest::setUp

Same name in this branch
  1. 10 core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php \Drupal\Tests\jsonapi\Kernel\Serializer\SerializerTest::setUp()
Same name in other branches
  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()
  3. 8.9.x core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php \Drupal\Tests\jsonapi\Kernel\Serializer\SerializerTest::setUp()
  4. 8.9.x core/modules/rest/tests/src/Unit/Plugin/views/style/SerializerTest.php \Drupal\Tests\rest\Unit\Plugin\views\style\SerializerTest::setUp()
  5. 11.x core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php \Drupal\Tests\jsonapi\Kernel\Serializer\SerializerTest::setUp()
  6. 11.x 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 37

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.