function SerializerTest::setUp

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

Class

SerializerTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21rest%21src%21Plugin%21views%21style%21Serializer.php/class/Serializer/9" title="The style plugin for serialized output formats." class="local">\Drupal\rest\Plugin\views\style\Serializer</a> @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.