public function DisplayPath::testMenuOptions

Tests the menu and tab option form.

File

drupal/core/modules/views_ui/lib/Drupal/views_ui/Tests/DisplayPath.php, line 61
Contains \Drupal\views_ui\Tests\DisplayPath

Class

DisplayPath
Tests the UI of generic display path plugin.

Namespace

Drupal\views_ui\Tests

Code

public function testMenuOptions() {
  $this->container
    ->get('module_handler')
    ->enable(array(
    'menu',
  ));
  $this
    ->drupalGet('admin/structure/views/view/test_view');

  // Add a new page display.
  $this
    ->drupalPost(NULL, array(), 'Add Page');

  // Save a path.
  $this
    ->drupalPost('admin/structure/views/nojs/display/test_view/page_1/path', array(
    'path' => $this
      ->randomString(),
  ), t('Apply'));
  $this
    ->drupalGet('admin/structure/views/view/test_view');
  $this
    ->drupalPost('admin/structure/views/nojs/display/test_view/page_1/menu', array(
    'menu[type]' => 'default tab',
    'menu[title]' => 'Test tab title',
  ), t('Apply'));
  $this
    ->assertResponse(200);
  $this
    ->assertUrl('admin/structure/views/nojs/display/test_view/page_1/tab_options');
  $this
    ->drupalPost(NULL, array(
    'tab_options[type]' => 'tab',
    'tab_options[title]' => $this
      ->randomString(),
  ), t('Apply'));
  $this
    ->assertResponse(200);
  $this
    ->assertUrl('admin/structure/views/view/test_view/edit/page_1');
  $this
    ->drupalGet('admin/structure/views/view/test_view');
  $this
    ->assertLink(t('Tab: @title', array(
    '@title' => 'Test tab title',
  )));

  // If it's a default tab, it should also have an additional settings link.
  $this
    ->assertLinkByHref('admin/structure/views/nojs/display/test_view/page_1/tab_options');
}