diff --git a/core/modules/views_ui/src/Tests/DisplayOrderTest.php b/core/modules/views_ui/src/Tests/DisplayOrderTest.php index 053c55b..db57632 100644 --- a/core/modules/views_ui/src/Tests/DisplayOrderTest.php +++ b/core/modules/views_ui/src/Tests/DisplayOrderTest.php @@ -7,6 +7,7 @@ namespace Drupal\views_ui\Tests; +use Drupal\Core\Url; use Drupal\views\Views; /** @@ -42,7 +43,8 @@ public function testDisplayOrder() { $settings['page[create]'] = FALSE; $view = $this->randomView($settings); - $path_prefix = 'admin/structure/views/view/' . $view['id'] . '/edit'; + $view_id = $view['id']; + $path_prefix = 'admin/structure/views/view/' . $view_id . '/edit'; $this->drupalGet($path_prefix); // Add a new page display. @@ -52,7 +54,7 @@ public function testDisplayOrder() { $this->assertNoLink('Master*', 0, 'Make sure the master display is not marked as changed.'); $this->assertLink('Page*', 0, 'Make sure the added display is marked as changed.'); - $this->drupalPostForm("admin/structure/views/nojs/display/{$view['id']}/page_1/path", array('path' => 'test/path'), t('Apply')); + $this->drupalPostForm("admin/structure/views/nojs/display/{$view_id}/page_1/path", array('path' => 'test/path'), t('Apply')); $this->drupalPostForm(NULL, array(), t('Save')); // Add a new block display. @@ -61,10 +63,17 @@ public function testDisplayOrder() { $this->drupalPostForm(NULL, array(), t('Save')); // Test that the new view displays are in the correct order. - $view = Views::getView($view['id']); + $view = Views::getView($view_id); $displays = $view->storage->get('display'); $expected_displays = array('default', 'block_1', 'page_1'); $this->assertEqual(array_keys($displays), $expected_displays, 'The display names are in correct order.'); + + // Ensure that the displays also appear in the right order in the UI. + $result = $this->cssSelect('ul#views-display-menu-tabs li a'); + $this->assertEqual(count($result), 3); + $this->assertEqual(Url::fromRoute('entity.view.edit_display_form', ['view' => $view_id, 'display_id' => 'default'])->toString(), (string) $result[0]['href']); + $this->assertEqual(Url::fromRoute('entity.view.edit_display_form', ['view' => $view_id, 'display_id' => 'page_1'])->toString(), (string) $result[1]['href']); + $this->assertEqual(Url::fromRoute('entity.view.edit_display_form', ['view' => $view_id, 'display_id' => 'block_1'])->toString(), (string) $result[2]['href']); } }