You are here

protected function PageManagerAdminTest::doTestReorderVariants in Page Manager 8

Tests reordering variants.

1 call to PageManagerAdminTest::doTestReorderVariants()
PageManagerAdminTest::testAdmin in page_manager_ui/src/Tests/PageManagerAdminTest.php
Tests the Page Manager admin UI.

File

page_manager_ui/src/Tests/PageManagerAdminTest.php, line 417
Contains \Drupal\page_manager_ui\Tests\PageManagerAdminTest.

Class

PageManagerAdminTest
Tests the admin UI for page entities.

Namespace

Drupal\page_manager_ui\Tests

Code

protected function doTestReorderVariants() {
  $this
    ->drupalGet('admin/foo');
  $this
    ->assertResponse(200);
  $elements = $this
    ->xpath('//div[@class="block-region-bottom"]/nav/ul[@class="menu"]/li/a');
  $expected = [
    'My account',
    'Log out',
  ];
  $links = [];
  foreach ($elements as $element) {
    $links[] = (string) $element;
  }
  $this
    ->assertEqual($expected, $links);
  $this
    ->drupalGet('admin/structure/page_manager/manage/foo/general');
  $this
    ->clickLink('Reorder variants');
  $edit = [
    'variants[foo-http_status_code-0][weight]' => -10,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Update');
  $this
    ->drupalPostForm(NULL, [], 'Update and save');
  $this
    ->drupalGet('admin/foo');
  $this
    ->assertResponse(403);
}