You are here

public function BlockTest::testBlockAccess in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block/tests/src/Functional/BlockTest.php \Drupal\Tests\block\Functional\BlockTest::testBlockAccess()
  2. 10 core/modules/block/tests/src/Functional/BlockTest.php \Drupal\Tests\block\Functional\BlockTest::testBlockAccess()

Tests the block access.

File

core/modules/block/tests/src/Functional/BlockTest.php, line 511

Class

BlockTest
Tests basic block functionality.

Namespace

Drupal\Tests\block\Functional

Code

public function testBlockAccess() {
  $this
    ->drupalPlaceBlock('test_access', [
    'region' => 'help',
  ]);
  $this
    ->drupalGet('<front>');
  $this
    ->assertNoText('Hello test world');
  \Drupal::state()
    ->set('test_block_access', TRUE);
  $this
    ->drupalGet('<front>');
  $this
    ->assertText('Hello test world');
}