function TermKernelTest::testRevisionLogAccess

Same name in other branches
  1. 10 core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php \Drupal\Tests\taxonomy\Kernel\TermKernelTest::testRevisionLogAccess()

Tests revision log access.

File

core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php, line 179

Class

TermKernelTest
Kernel tests for taxonomy term functions.

Namespace

Drupal\Tests\taxonomy\Kernel

Code

public function testRevisionLogAccess() : void {
    $vocabulary = $this->createVocabulary();
    $entity = $this->createTerm($vocabulary, [
        'status' => TRUE,
    ]);
    $admin = $this->createUser([
        'administer taxonomy',
        'access content',
    ]);
    $editor = $this->createUser([
        'edit terms in ' . $vocabulary->id(),
        'access content',
    ]);
    $viewer = $this->createUser([
        'access content',
    ]);
    $this->assertTrue($entity->get('revision_log_message')
        ->access('view', $admin));
    $this->assertTrue($entity->get('revision_log_message')
        ->access('view', $editor));
    $this->assertFalse($entity->get('revision_log_message')
        ->access('view', $viewer));
}

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