function RssFieldsTest::testLink
Tests correct processing of link fields.
This overlaps with \Drupal\Tests\views\Functional\Plugin\DisplayFeedTest to ensure that root-relative links also work in a scenario without subdirectory.
File
- 
              core/modules/ views/ tests/ src/ Kernel/ Plugin/ RssFieldsTest.php, line 51 
Class
Namespace
Drupal\Tests\views\Kernel\PluginCode
public function testLink() {
  // Set up the current user as uid 1 so the test doesn't need to deal with
  // permission.
  $this->setUpCurrentUser([
    'uid' => 1,
  ]);
  $node = $this->createNode([
    'type' => 'article',
    'title' => 'Article title',
    'body' => [
      0 => [
        'value' => 'A paragraph',
        'format' => filter_default_format(),
      ],
    ],
  ]);
  $node_url = $node->toUrl()
    ->setAbsolute()
    ->toString();
  $renderer = $this->container
    ->get('renderer');
  $view = Views::getView('test_display_feed');
  $output = $view->preview('feed_2');
  $output = (string) $renderer->renderRoot($output);
  $this->assertStringContainsString('<link>' . $node_url . '</link>', $output);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
