You are here

protected function PageManagerAdminTest::doTestAddBlockWithAjax in Page Manager 8

Tests adding a block with #ajax to a variant.

1 call to PageManagerAdminTest::doTestAddBlockWithAjax()
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 520
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 doTestAddBlockWithAjax() {
  $this
    ->drupalGet('admin/structure/page_manager/manage/foo/page_variant__foo-block_display-0__content');

  // Add a block to the variant.
  $this
    ->clickLink('Add new block');
  $this
    ->clickLink('Page Manager Test Block');
  $edit = [
    'region' => 'top',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Add block');
  $this
    ->drupalPostForm(NULL, [], 'Update and save');

  // Test that the block is displayed.
  $this
    ->drupalGet('admin/foo');
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Example output'));

  // Check the block label.
  $this
    ->assertRaw('Page Manager Test Block');
}