You are here

protected function PageManagerAdminTest::doTestExistingPathWithoutParameters in Page Manager 8

Tests adding a page with an existing path with no route parameters.

1 call to PageManagerAdminTest::doTestExistingPathWithoutParameters()
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 542
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 doTestExistingPathWithoutParameters() {

  // Test an existing path.
  $this
    ->drupalGet('admin');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('admin/structure/page_manager');

  // Add a new page with existing path 'admin'.
  $this
    ->clickLink('Add page');
  $edit = [
    'label' => 'existing',
    'id' => 'existing',
    'path' => 'admin',
    'variant_plugin_id' => 'http_status_code',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Next');

  // Configure the variant.
  $edit = [
    'page_variant_label' => 'Status Code',
    'variant_settings[status_code]' => 404,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Finish');

  // Ensure the existing path leads to the new page.
  $this
    ->drupalGet('admin');
  $this
    ->assertResponse(404);
}