function BlockContentAccessHandlerTest::testRevisionLogAccess

Same name and namespace in other branches
  1. 11.x core/modules/block_content/tests/src/Kernel/BlockContentAccessHandlerTest.php \Drupal\Tests\block_content\Kernel\BlockContentAccessHandlerTest::testRevisionLogAccess()

Tests revision log access.

File

core/modules/block_content/tests/src/Kernel/BlockContentAccessHandlerTest.php, line 603

Class

BlockContentAccessHandlerTest
Tests the block content entity access handler.

Namespace

Drupal\Tests\block_content\Kernel

Code

public function testRevisionLogAccess() : void {
  $admin = $this->createUser([
    'administer block content',
    'access content',
  ]);
  $editor = $this->createUser([
    'access content',
    'access block library',
    'view any square block content history',
  ]);
  $viewer = $this->createUser([
    'access content',
  ]);
  $this->assertTrue($this->blockEntity
    ->get('revision_log')
    ->access('view', $admin));
  $this->assertTrue($this->blockEntity
    ->get('revision_log')
    ->access('view', $editor));
  $this->assertFalse($this->blockEntity
    ->get('revision_log')
    ->access('view', $viewer));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.