protected function PageManagerAdminTest::doTestRemoveBlock in Page Manager 8
Tests removing a block.
1 call to PageManagerAdminTest::doTestRemoveBlock()
- 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 491 - Contains \Drupal\page_manager_ui\Tests\PageManagerAdminTest.
Class
- PageManagerAdminTest
- Tests the admin UI for page entities.
Namespace
Drupal\page_manager_ui\TestsCode
protected function doTestRemoveBlock() {
// Assert that the block is displayed.
$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/page_variant__foo-block_display-0__content');
$this
->clickLink('Delete');
$this
->assertRaw(new FormattableMarkup('Are you sure you want to delete the block %label?', [
'%label' => 'User account menu',
]));
$this
->drupalPostForm(NULL, [], 'Delete');
$this
->assertRaw(new FormattableMarkup('The block %label has been removed.', [
'%label' => 'User account menu',
]));
$this
->drupalPostForm(NULL, [], 'Update and save');
// Assert that the block is now gone.
$this
->drupalGet('admin/foo');
$this
->assertResponse(200);
$elements = $this
->xpath('//div[@class="block-region-bottom"]/nav/ul[@class="menu"]/li/a');
$this
->assertTrue(empty($elements));
}