function MigrateUpgradeExecuteTestBase::assertEntityRevisionsCount

Same name in other branches
  1. 11.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase::assertEntityRevisionsCount()

Checks the number of the specified entity's revisions.

Revision translations are excluded.

Parameters

string $content_entity_type_id: The entity type ID of the content entity, e.g. 'node', 'media', 'block_content'.

int $expected_revision_count: The expected number of the revisions.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

2 calls to MigrateUpgradeExecuteTestBase::assertEntityRevisionsCount()
Upgrade6Test::testUpgradeAndIncremental in core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
Executes all steps of migrations upgrade.
Upgrade7Test::testUpgradeAndIncremental in core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
Executes all steps of migrations upgrade.

File

core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php, line 127

Class

MigrateUpgradeExecuteTestBase
Provides a base class for testing a complete upgrade via the UI.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

protected function assertEntityRevisionsCount(string $content_entity_type_id, int $expected_revision_count) {
    $entity_storage = \Drupal::entityTypeManager()->getStorage($content_entity_type_id);
    assert($entity_storage instanceof ContentEntityStorageInterface);
    $revision_ids = $entity_storage->getQuery()
        ->allRevisions()
        ->accessCheck(FALSE)
        ->execute();
    $this->assertCount($expected_revision_count, $revision_ids, sprintf("The number of %s revisions is different than expected", $content_entity_type_id));
}

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