Mercurial > hg > isophonics-drupal-site
annotate core/modules/block/tests/src/Functional/BlockHookOperationTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Tests\block\Functional; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Component\Utility\Unicode; |
Chris@0 | 6 use Drupal\Tests\BrowserTestBase; |
Chris@0 | 7 |
Chris@0 | 8 /** |
Chris@0 | 9 * Tests for Block module regarding hook_entity_operations_alter(). |
Chris@0 | 10 * |
Chris@0 | 11 * @group block |
Chris@0 | 12 */ |
Chris@0 | 13 class BlockHookOperationTest extends BrowserTestBase { |
Chris@0 | 14 |
Chris@0 | 15 /** |
Chris@0 | 16 * Modules to install. |
Chris@0 | 17 * |
Chris@0 | 18 * @var array |
Chris@0 | 19 */ |
Chris@0 | 20 public static $modules = ['block', 'entity_test']; |
Chris@0 | 21 |
Chris@0 | 22 protected function setUp() { |
Chris@0 | 23 parent::setUp(); |
Chris@0 | 24 |
Chris@0 | 25 $permissions = [ |
Chris@0 | 26 'administer blocks', |
Chris@0 | 27 ]; |
Chris@0 | 28 |
Chris@0 | 29 // Create and log in user. |
Chris@0 | 30 $admin_user = $this->drupalCreateUser($permissions); |
Chris@0 | 31 $this->drupalLogin($admin_user); |
Chris@0 | 32 } |
Chris@0 | 33 |
Chris@0 | 34 /** |
Chris@0 | 35 * Tests the block list to see if the test_operation link is added. |
Chris@0 | 36 */ |
Chris@0 | 37 public function testBlockOperationAlter() { |
Chris@0 | 38 // Add a test block, any block will do. |
Chris@0 | 39 // Set the machine name so the test_operation link can be built later. |
Chris@0 | 40 $block_id = Unicode::strtolower($this->randomMachineName(16)); |
Chris@0 | 41 $this->drupalPlaceBlock('system_powered_by_block', ['id' => $block_id]); |
Chris@0 | 42 |
Chris@0 | 43 // Get the Block listing. |
Chris@0 | 44 $this->drupalGet('admin/structure/block'); |
Chris@0 | 45 |
Chris@0 | 46 $test_operation_link = 'admin/structure/block/manage/' . $block_id . '/test_operation'; |
Chris@0 | 47 // Test if the test_operation link is on the page. |
Chris@0 | 48 $this->assertLinkByHref($test_operation_link); |
Chris@0 | 49 } |
Chris@0 | 50 |
Chris@0 | 51 } |