You are here

protected function PageManagerAdminTest::doTestEditVariant in Page Manager 8

Tests editing a variant.

1 call to PageManagerAdminTest::doTestEditVariant()
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 391
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 doTestEditVariant() {
  if (!($block = $this
    ->findBlockByLabel('foo-block_display-0', 'User account menu'))) {
    $this
      ->fail('Block not found');
    return;
  }
  $block_config = $block
    ->getConfiguration();
  $this
    ->drupalGet('admin/structure/page_manager/manage/foo/page_variant__foo-block_display-0__content');
  $this
    ->assertOptionSelected('edit-blocks-' . $block_config['uuid'] . '-region', 'top');
  $this
    ->assertOptionSelected('edit-blocks-' . $block_config['uuid'] . '-weight', 0);
  $form_name = 'blocks[' . $block_config['uuid'] . ']';
  $edit = [
    $form_name . '[region]' => 'bottom',
    $form_name . '[weight]' => -10,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Update');
  $this
    ->assertOptionSelected('edit-blocks-' . $block_config['uuid'] . '-region', 'bottom');
  $this
    ->assertOptionSelected('edit-blocks-' . $block_config['uuid'] . '-weight', -10);
  $this
    ->drupalPostForm(NULL, [], 'Update and save');
}