1.20.x views_plugin_style_jump_menu.test ViewsPluginStyleJumpMenuTest::testDuplicatePaths()

Tests jump menus with more than one same path but maybe different titles.

File

modules/views/tests/styles/views_plugin_style_jump_menu.test, line 39
Definition of viewsPluginStyleJumpMenuTest.

Class

ViewsPluginStyleJumpMenuTest
Tests jump menu style functionality.

Code

function testDuplicatePaths() {
  $view = $this->getJumpMenuView();
  $view->set_display();
  $view->init_handlers();

  // Setup a [path] which would lead to "duplicate" paths, but still the shouldn't be used for grouping.
  $view->field['nothing']->options['alter']['text'] = '[path]';
  $view->preview();
  $form = $view->style_plugin->render($view->result);

  // As there is no grouping setup it should be 4 elements.
  $this->assertEqual(count($form['jump']['#options']), 4 + 1);

  // Check that all titles are part of the form as well.
  $options = array_values($form['jump']['#options']);
  foreach ($options as $key => $title) {
    // The first one is the choose label.
    if ($key == 0) {
      continue;
    }
    $this->assertTrue($this->nodeTitles[$key - 1] == trim($title), t('Title @title should appear on the jump list, as we do not filter', array('@title' => $title)));
  }
}