function RevisionRevertFormTest::testAccessRevertLatestForwardRevision

Same name in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php \Drupal\FunctionalTests\Entity\RevisionRevertFormTest::testAccessRevertLatestForwardRevision()

Ensures that forward revisions can be reverted.

@covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess

1 call to RevisionRevertFormTest::testAccessRevertLatestForwardRevision()
RevisionRevertFormTest::testFormRevisionRevert in core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
Test form revision revert.

File

core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php, line 132

Class

RevisionRevertFormTest
Tests reverting a revision with revision revert form.

Namespace

Drupal\FunctionalTests\Entity

Code

protected function testAccessRevertLatestForwardRevision() : void {
    
    /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
    $entity = EntityTestRevPub::create();
    $entity->setName('revert');
    $entity->isDefaultRevision(TRUE);
    $entity->setPublished();
    $entity->setNewRevision();
    $entity->save();
    $entity->isDefaultRevision(FALSE);
    $entity->setUnpublished();
    $entity->setNewRevision();
    $entity->save();
    $this->drupalGet($entity->toUrl('revision-revert-form'));
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertTrue($entity->access('revert', $this->rootUser, FALSE));
}

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