function RevisionLinkDeleteTest::testRenderNullEntity

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

Test the render method when getEntity returns NULL.

@covers ::render

File

core/modules/node/tests/src/Unit/Plugin/views/field/RevisionLinkDeleteTest.php, line 43

Class

RevisionLinkDeleteTest
@coversDefaultClass \Drupal\node\Plugin\views\field\RevisionLinkDelete @group node

Namespace

Drupal\Tests\node\Unit\Plugin\views\field

Code

public function testRenderNullEntity() : void {
    $row = new ResultRow();
    $field = new RevisionLinkDelete([
        'entity_type' => 'foo',
        'entity field' => 'bar',
    ], '', [], $this->createMock(AccessManagerInterface::class), $this->createMock(EntityTypeManagerInterface::class), $this->createMock(EntityRepositoryInterface::class), $this->createMock(LanguageManagerInterface::class));
    $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.