function ContactLinkTest::testRenderNullEntity
Same name and namespace in other branches
- 10 core/modules/contact/tests/src/Unit/ContactLinkTest.php \Drupal\Tests\contact\Unit\ContactLinkTest::testRenderNullEntity()
Test the render method when getEntity returns NULL.
@covers ::render
File
-
core/
modules/ contact/ tests/ src/ Unit/ ContactLinkTest.php, line 43
Class
- ContactLinkTest
- @coversDefaultClass <a href="/api/drupal/core%21modules%21contact%21src%21Plugin%21views%21field%21ContactLink.php/class/ContactLink/11.x" title="Defines a field that links to the user contact page, if access is permitted." class="local">\Drupal\contact\Plugin\views\field\ContactLink</a> @group contact
Namespace
Drupal\Tests\contact\UnitCode
public function testRenderNullEntity() : void {
$row = new ResultRow();
$field = new ContactLink([
'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.