function RevisionVersionHistoryTest::testDescriptionNoRevLogWithLabelAccess

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php \Drupal\FunctionalTests\Entity\RevisionVersionHistoryTest::testDescriptionNoRevLogWithLabelAccess()

Test description with entity, without revision log, with label access.

@covers ::getRevisionDescription

File

core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php, line 154

Class

RevisionVersionHistoryTest
Tests version history page.

Namespace

Drupal\FunctionalTests\Entity

Code

public function testDescriptionNoRevLogWithLabelAccess() : void {
  // Permission grants 'view label' access.
  $this->drupalLogin($this->createUser([
    'view test entity',
  ]));
  /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
  $entity = EntityTestRev::create([
    'type' => 'entity_test_rev',
  ]);
  $entity->setName('view all revisions');
  $entity->save();
  $this->drupalGet($entity->toUrl('version-history'));
  $this->assertSession()
    ->elementTextContains('css', 'table tbody tr:nth-child(1)', $entity->getName());
  $this->assertSession()
    ->elementTextNotContains('css', 'table tbody tr:nth-child(1)', '- Restricted access -');
}

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