You are here

public function DisplayFeedTest::testFeedFieldOutput in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/DisplayFeedTest.php \Drupal\views\Tests\Plugin\DisplayFeedTest::testFeedFieldOutput()

Tests the rendered output for fields display.

File

core/modules/views/src/Tests/Plugin/DisplayFeedTest.php, line 104
Contains \Drupal\views\Tests\Plugin\DisplayFeedTest.

Class

DisplayFeedTest
Tests the feed display plugin.

Namespace

Drupal\views\Tests\Plugin

Code

public function testFeedFieldOutput() {
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);

  // Verify a title with HTML entities is properly escaped.
  $node_title = 'This "cool" & "neat" article\'s title';
  $this
    ->drupalCreateNode(array(
    'title' => $node_title,
    'body' => [
      0 => [
        'value' => 'A paragraph',
        'format' => filter_default_format(),
      ],
    ],
  ));
  $this
    ->drupalGet('test-feed-display-fields.xml');
  $result = $this
    ->xpath('//title/a');
  $this
    ->assertEqual($result[0], $node_title, 'Node title with HTML entities displays correctly.');

  // Verify HTML is properly escaped in the description field.
  $this
    ->assertRaw('<p>A paragraph</p>');
}