EntityLinkTest.php
Same filename in this branch
Same filename and directory in other branches
- 11.x core/modules/comment/tests/src/Unit/Plugin/views/field/EntityLinkTest.php
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
- 10 core/modules/comment/tests/src/Unit/Plugin/views/field/EntityLinkTest.php
- 10 core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
- 9 core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
Namespace
Drupal\Tests\comment\Unit\Plugin\views\fieldFile
-
core/
modules/ comment/ tests/ src/ Unit/ Plugin/ views/ field/ EntityLinkTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\comment\Unit\Plugin\views\field;
use Drupal\comment\Plugin\views\field\EntityLink;
use Drupal\Tests\UnitTestCase;
use Drupal\Tests\views\Traits\ViewsLoggerTestTrait;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ResultRow;
use Drupal\views\ViewExecutable;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
/**
* Tests Drupal\comment\Plugin\views\field\EntityLink.
*/
class EntityLinkTest extends UnitTestCase {
use ViewsLoggerTestTrait;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->setUpMockLoggerWithMissingEntity();
}
/**
* Test the render method when getEntity returns NULL.
*/
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));
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| EntityLinkTest | Tests Drupal\comment\Plugin\views\field\EntityLink. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.