protected function OverriddenConfigurationTest::assertOverriddenBlockDisabled in Drupal 10
Same name and namespace in other branches
- 8 core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\OverriddenConfigurationTest::assertOverriddenBlockDisabled()
- 9 core/modules/settings_tray/tests/src/FunctionalJavascript/OverriddenConfigurationTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\OverriddenConfigurationTest::assertOverriddenBlockDisabled()
Asserts that an overridden block has Settings Tray disabled.
@internal
Parameters
\Drupal\block\Entity\Block $overridden_block: The overridden block.
string $override_text: The override text that should appear in the block.
File
- core/
modules/ settings_tray/ tests/ src/ FunctionalJavascript/ OverriddenConfigurationTest.php, line 162
Class
- OverriddenConfigurationTest
- Tests handling of configuration overrides.
Namespace
Drupal\Tests\settings_tray\FunctionalJavascriptCode
protected function assertOverriddenBlockDisabled(Block $overridden_block, string $override_text) : void {
$web_assert = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$block_selector = $this
->getBlockSelector($overridden_block);
$block_id = $overridden_block
->id();
// Confirm the block does not have a quick edit link.
$contextual_links = $page
->findAll('css', "{$block_selector} .contextual-links li a");
$this
->assertNotEmpty($contextual_links);
foreach ($contextual_links as $link) {
$this
->assertStringNotContainsString("/admin/structure/block/manage/{$block_id}/off-canvas", $link
->getAttribute('href'));
}
// Confirm the block is not marked as Settings Tray editable.
$this
->assertFalse($page
->find('css', $block_selector)
->hasAttribute('data-drupal-settingstray'));
// Confirm the text is actually overridden.
$web_assert
->elementContains('css', $this
->getBlockSelector($overridden_block), $override_text);
}