public function FieldPluginBaseTest::testRenderAsLinkWithPathAndOptions in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::testRenderAsLinkWithPathAndOptions()
- 9 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::testRenderAsLinkWithPathAndOptions()
Tests rendering of a link with a path and options.
@dataProvider providerTestRenderAsLinkWithPathAndOptions @covers ::renderAsLink
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ field/ FieldPluginBaseTest.php, line 321 - 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\fieldCode
public function testRenderAsLinkWithPathAndOptions($path, $alter, $link_html, $final_html = NULL) {
$alter += [
'make_link' => TRUE,
'path' => $path,
];
$final_html = $final_html ?? $link_html;
$this
->setUpUrlIntegrationServices();
$this
->setupDisplayWithEmptyArgumentsAndFields();
$field = $this
->setupTestField([
'alter' => $alter,
]);
$field->field_alias = 'key';
$row = new ResultRow([
'key' => 'value',
]);
$result = $field
->advancedRender($row);
$this
->assertEquals($final_html, (string) $result);
}