3 namespace Drupal\Tests\block\Functional;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests for Block module regarding hook_entity_operations_alter().
12 class BlockHookOperationTest extends BrowserTestBase {
19 public static $modules = ['block', 'entity_test'];
21 protected function setUp() {
28 // Create and log in user.
29 $admin_user = $this->drupalCreateUser($permissions);
30 $this->drupalLogin($admin_user);
34 * Tests the block list to see if the test_operation link is added.
36 public function testBlockOperationAlter() {
37 // Add a test block, any block will do.
38 // Set the machine name so the test_operation link can be built later.
39 $block_id = mb_strtolower($this->randomMachineName(16));
40 $this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]);
42 // Get the Block listing.
43 $this->drupalGet('admin/structure/block');
45 $test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation';
46 // Test if the test_operation link is on the page.
47 $this->assertLinkByHref($test_operation_link);