function RevisionDeleteFormTest::testAccessDeleteLatestForwardRevision

Same name in other branches
  1. 10 core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php \Drupal\FunctionalTests\Entity\RevisionDeleteFormTest::testAccessDeleteLatestForwardRevision()

Ensure that forward revision can be deleted.

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

1 call to RevisionDeleteFormTest::testAccessDeleteLatestForwardRevision()
RevisionDeleteFormTest::testAccessDelete in core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php
Test that revisions can and can't be deleted in various scenarios.

File

core/tests/Drupal/FunctionalTests/Entity/RevisionDeleteFormTest.php, line 138

Class

RevisionDeleteFormTest
Tests deleting a revision with revision delete form.

Namespace

Drupal\FunctionalTests\Entity

Code

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

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