You are here

public function FieldPluginBaseTest::testRenderAsLinkWithoutPath in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::testRenderAsLinkWithoutPath()

Tests rendering as a link without a path.

@covers ::renderAsLink

File

core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php, line 217
Contains \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest.

Class

FieldPluginBaseTest
@coversDefaultClass \Drupal\views\Plugin\views\field\FieldPluginBase @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

public function testRenderAsLinkWithoutPath() {
  $alter = [
    'make_link' => TRUE,
  ];
  $this
    ->setUpUrlIntegrationServices();
  $field = $this
    ->setupTestField([
    'alter' => $alter,
  ]);
  $field->field_alias = 'key';
  $row = new ResultRow([
    'key' => 'value',
  ]);
  $expected_result = 'value';
  $result = $field
    ->advancedRender($row);
  $this
    ->assertEquals($expected_result, $result);
}