Newer
Older
Alex Pott
committed
<?php
namespace Drupal\Tests\block\Functional;
Alex Pott
committed
use Drupal\Tests\BrowserTestBase;
Alex Pott
committed
/**
* Tests for Block module regarding hook_entity_operations_alter().
*
* @group block
Alex Pott
committed
*/
class BlockHookOperationTest extends BrowserTestBase {
Alex Pott
committed
/**
Jennifer Hodgdon
committed
* Modules to install.
Alex Pott
committed
*
* @var array
*/
public static $modules = ['block', 'entity_test'];
Alex Pott
committed
Alex Pott
committed
protected function setUp() {
Alex Pott
committed
parent::setUp();
$permissions = [
Alex Pott
committed
'administer blocks',
];
Alex Pott
committed
// Create and log in user.
$admin_user = $this->drupalCreateUser($permissions);
$this->drupalLogin($admin_user);
}
/**
Alex Pott
committed
* Tests the block list to see if the test_operation link is added.
*/
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 = mb_strtolower($this->randomMachineName(16));
$this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]);
Alex Pott
committed
// Get the Block listing.
$this->drupalGet('admin/structure/block');
$test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation';