function RevisionDeleteFormTest::testAccessDeleteLatestDefault

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

Test cannot delete latest revision.

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

File

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

Class

RevisionDeleteFormTest
Tests deleting a revision with revision delete form.

Namespace

Drupal\FunctionalTests\Entity

Code

public function testAccessDeleteLatestDefault() : void {
    
    /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */
    $entity = EntityTestRev::create();
    $entity->setName('delete revision');
    $entity->save();
    $entity->setNewRevision();
    $entity->save();
    $this->drupalGet($entity->toUrl('revision-delete-form'));
    $this->assertSession()
        ->statusCodeEquals(403);
}

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