function EntityLinkTest::testRenderNullEntity

Same name and namespace in other branches
  1. 10 core/modules/comment/tests/src/Unit/Plugin/views/field/EntityLinkTest.php \Drupal\Tests\comment\Unit\Plugin\views\field\EntityLinkTest::testRenderNullEntity()

Test the render method when getEntity returns NULL.

@covers ::render

File

core/modules/comment/tests/src/Unit/Plugin/views/field/EntityLinkTest.php, line 35

Class

EntityLinkTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21comment%21src%21Plugin%21views%21field%21EntityLink.php/class/EntityLink/11.x" title="Handler for showing comment module&#039;s entity links." class="local">\Drupal\comment\Plugin\views\field\EntityLink</a> @group comment

Namespace

Drupal\Tests\comment\Unit\Plugin\views\field

Code

public function testRenderNullEntity() : void {
    $row = new ResultRow();
    $field = new EntityLink([
        'entity_type' => 'foo',
        'entity field' => 'bar',
    ], '', []);
    $view = $this->createMock(ViewExecutable::class);
    $display = $this->createMock(DisplayPluginBase::class);
    $field->init($view, $display);
    $this->assertEmpty($field->render($row));
}

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