BlockHookOperationTest.php in Drupal 9
File
core/modules/block/tests/src/Functional/BlockHookOperationTest.php
View source
<?php
namespace Drupal\Tests\block\Functional;
use Drupal\Tests\BrowserTestBase;
class BlockHookOperationTest extends BrowserTestBase {
protected static $modules = [
'block',
'entity_test',
];
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$permissions = [
'administer blocks',
];
$admin_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($admin_user);
}
public function testBlockOperationAlter() {
$block_id = mb_strtolower($this
->randomMachineName(16));
$this
->drupalPlaceBlock('system_powered_by_block', [
'id' => $block_id,
]);
$this
->drupalGet('admin/structure/block');
$test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation';
$this
->assertSession()
->linkByHrefExists($test_operation_link);
}
}