function RevisionRevertFormTest::countRevisions

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

Count number of revisions for an entity type.

Parameters

string $entityTypeId: The entity type.

Return value

int Number of revisions for an entity type.

2 calls to RevisionRevertFormTest::countRevisions()
RevisionRevertFormTest::testPrepareRevision in core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
Tests the revert process.
RevisionRevertFormTest::testSubmitForm in core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php
Tests revision revert, and expected response after revert.

File

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

Class

RevisionRevertFormTest
Tests reverting a revision with revision revert form.

Namespace

Drupal\FunctionalTests\Entity

Code

protected function countRevisions(string $entityTypeId) : int {
    return (int) \Drupal::entityTypeManager()->getStorage($entityTypeId)
        ->getQuery()
        ->accessCheck(FALSE)
        ->allRevisions()
        ->count()
        ->execute();
}

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