function RevisionLinkRevertTest::testRenderNullEntity

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

Test the render method when getEntity returns NULL.

@covers ::render

File

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

Class

RevisionLinkRevertTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21node%21src%21Plugin%21views%21field%21RevisionLinkRevert.php/class/RevisionLinkRevert/11.x" title="Field handler to present a link to revert a node to a revision." class="local">\Drupal\node\Plugin\views\field\RevisionLinkRevert</a> @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.