public function DisplayFeedTest::testFeedUI

Tests feed display admin ui.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php, line 51
Definition of Drupal\views\Tests\Plugin\DisplayFeedTest.

Class

DisplayFeedTest
Tests the feed display plugin.

Namespace

Drupal\views\Tests\Plugin

Code

public function testFeedUI() {
  $this
    ->drupalGet('admin/structure/views');

  // Check the attach TO interface.
  $this
    ->drupalGet('admin/structure/views/nojs/display/test_feed_display/feed/displays');

  // Load all the options of the checkbox.
  $result = $this
    ->xpath('//div[@id="edit-displays"]/div');
  $options = array();
  foreach ($result as $value) {
    foreach ($value->input
      ->attributes() as $attribute => $value) {
      if ($attribute == 'value') {
        $options[] = (string) $value;
      }
    }
  }
  $this
    ->assertEqual($options, array(
    'default',
    'page',
  ), 'Make sure all displays appears as expected.');

  // Post and save this and check the output.
  $this
    ->drupalPost('admin/structure/views/nojs/display/test_feed_display/feed/displays', array(
    'displays[page]' => 'page',
  ), t('Apply'));
  $this
    ->drupalGet('admin/structure/views/view/test_feed_display/edit/feed');
  $this
    ->assertFieldByXpath('//*[@id="views-feed-displays"]', 'Page');

  // Add the default display, so there should now be multiple displays.
  $this
    ->drupalPost('admin/structure/views/nojs/display/test_feed_display/feed/displays', array(
    'displays[default]' => 'default',
  ), t('Apply'));
  $this
    ->drupalGet('admin/structure/views/view/test_feed_display/edit/feed');
  $this
    ->assertFieldByXpath('//*[@id="views-feed-displays"]', 'Multiple displays');
}