function FieldPluginBaseTest::testRenderAsLinkWithoutPath

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::testRenderAsLinkWithoutPath()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::testRenderAsLinkWithoutPath()
  3. 10 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 214

Class

FieldPluginBaseTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21field%21FieldPluginBase.php/class/FieldPluginBase/11.x" title="Base class for views fields." class="local">\Drupal\views\Plugin\views\field\FieldPluginBase</a> @group views

Namespace

Drupal\Tests\views\Unit\Plugin\field

Code

public function testRenderAsLinkWithoutPath() : void {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.