You are here

protected function DisplayFeedTest::checkFeedViewUi in Zircon Profile 8

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

Checks views UI for a specific feed view.

Parameters

string $view_name: The view name to check against.

1 call to DisplayFeedTest::checkFeedViewUi()
DisplayFeedTest::testFeedUI in core/modules/views_ui/src/Tests/DisplayFeedTest.php
Tests feed display admin UI.

File

core/modules/views_ui/src/Tests/DisplayFeedTest.php, line 48
Contains \Drupal\views_ui\Tests\DisplayFeedTest.

Class

DisplayFeedTest
Tests the UI for feed display plugin.

Namespace

Drupal\views_ui\Tests

Code

protected function checkFeedViewUi($view_name) {
  $this
    ->drupalGet('admin/structure/views');

  // Verify that the page lists the $view_name view.
  // Regression test: ViewListBuilder::getDisplayPaths() did not properly
  // check whether a DisplayPluginCollection was returned in iterating over
  // all displays.
  $this
    ->assertText($view_name);

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

  // Display labels should be escaped.
  $this
    ->assertEscaped('<em>Page</em>');

  // Load all the options of the checkbox.
  $result = $this
    ->xpath('//div[@id="edit-displays"]/div');
  $options = array();
  foreach ($result as $item) {
    foreach ($item->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
    ->drupalPostForm('admin/structure/views/nojs/display/' . $view_name . '/feed_1/displays', array(
    'displays[page]' => 'page',
  ), t('Apply'));

  // Options summary should be escaped.
  $this
    ->assertEscaped('<em>Page</em>');
  $this
    ->assertNoRaw('<em>Page</em>');
  $this
    ->drupalGet('admin/structure/views/view/' . $view_name . '/edit/feed_1');
  $this
    ->assertFieldByXpath('//*[@id="views-feed-1-displays"]', '<em>Page</em>');

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