function viewsPluginStyleJumpMenuTest::testDuplicatePaths

Tests jump menues with more then one same path but maybe differnet titles.

File

tests/styles/views_plugin_style_jump_menu.test, line 49

Class

viewsPluginStyleJumpMenuTest
Tests jump menu style functionality.

Code

public function testDuplicatePaths() {
    $view = $this->getJumpMenuView();
    $view->set_display();
    $view->init_handlers();
    // Setup a [path] which would leed 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,
        )));
    }
}