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