Same filename and directory in other branches
- 8.9.x core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
- 9 core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
Namespace
Drupal\Tests\block\Functional
File
core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\block\Functional;
use Drupal\block\Entity\Block;
trait AssertBlockAppearsTrait {
protected function assertBlockAppears(Block $block) {
$this
->assertSession()
->elementExists('xpath', "//div[@id = 'block-{$block->id()}']");
}
protected function assertNoBlockAppears(Block $block) {
$this
->assertSession()
->elementNotExists('xpath', "//div[@id = 'block-{$block->id()}']");
}
protected function findBlockInstance(Block $block) {
@trigger_error(__METHOD__ . '() is deprecated in drupal:9.5.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3293310', E_USER_DEPRECATED);
return $this
->xpath('//div[@id = :id]', [
':id' => 'block-' . $block
->id(),
]);
}
}
Traits