You are here

public function BlockHookOperationTest::testBlockOperationAlter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockHookOperationTest.php \Drupal\block\Tests\BlockHookOperationTest::testBlockOperationAlter()

File

core/modules/block/src/Tests/BlockHookOperationTest.php, line 44
Contains \Drupal\block\Tests\BlockHookOperationTest.

Class

BlockHookOperationTest
Implement hook entity operations alter.

Namespace

Drupal\block\Tests

Code

public function testBlockOperationAlter() {

  // Add a test block, any block will do.
  // Set the machine name so the test_operation link can be built later.
  $block_id = Unicode::strtolower($this
    ->randomMachineName(16));
  $this
    ->drupalPlaceBlock('system_powered_by_block', array(
    'id' => $block_id,
  ));

  // Get the Block listing.
  $this
    ->drupalGet('admin/structure/block');
  $test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation';

  // Test if the test_operation link is on the page.
  $this
    ->assertLinkByHref($test_operation_link);
}