public function FieldPluginBaseTest::testRenderTrimmedWithMoreLink in Zircon Profile 8.0
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::testRenderTrimmedWithMoreLink()
Test rendering as a link without a path.
@covers ::renderText
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ field/ FieldPluginBaseTest.php, line 234 - 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 testRenderTrimmedWithMoreLink() {
$alter = [
'trim' => TRUE,
'max_length' => 7,
'more_link' => TRUE,
// Don't invoke translation.
'ellipsis' => FALSE,
'more_link_text' => 'more link',
];
$this->display
->expects($this
->any())
->method('getHandlers')
->willReturnMap([
[
'argument',
[],
],
[
'field',
[],
],
]);
$this
->setUpUrlIntegrationServices();
$field = $this
->setupTestField([
'alter' => $alter,
]);
$field->field_alias = 'key';
$row = new ResultRow([
'key' => 'a long value',
]);
$expected_result = 'a long <a href="/%3Cfront%3E" class="views-more-link">more link</a>';
$result = $field
->advancedRender($row);
$this
->assertEquals($expected_result, $result);
}