You are here

public function PageManagerAdminTest::testExistingRoutes in Page Manager 8

Tests that default arguments are not removed from existing routes.

File

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

Class

PageManagerAdminTest
Tests the admin UI for page entities.

Namespace

Drupal\page_manager_ui\Tests

Code

public function testExistingRoutes() {

  // Test that the page without placeholder is accessible.
  $this
    ->drupalGet('admin/structure/page_manager/add');
  $edit = [
    'label' => 'Placeholder test 2',
    'id' => 'placeholder2',
    'path' => '/page-manager-test',
    'variant_plugin_id' => 'http_status_code',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Next');
  $edit = [
    'variant_settings[status_code]' => 418,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Finish');
  $this
    ->drupalGet('page-manager-test');
  $this
    ->assertResponse(418);

  // Test that the page test is accessible.
  $page_string = 'test-page';
  $this
    ->drupalGet('page-manager-test/' . $page_string);
  $this
    ->assertResponse(200);

  // Without a single variant, it will fall through to the original.
  $this
    ->drupalGet('admin/structure/page_manager/manage/placeholder2/page_variant__placeholder2-http_status_code-0__general');
  $this
    ->clickLink('Delete this variant');
  $this
    ->drupalPostForm(NULL, [], 'Delete');
  $this
    ->drupalPostForm(NULL, [], 'Update and save');
  $this
    ->drupalGet('page-manager-test');
  $this
    ->assertResponse(200);
}