function ContentModerationSyncingTest::getAllRevisionNames

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationSyncingTest::getAllRevisionNames()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationSyncingTest::getAllRevisionNames()
  3. 11.x core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationSyncingTest::getAllRevisionNames()

Get all the revision names in order of the revision ID.

Parameters

\Drupal\entity_test\Entity\EntityTestMulRevPub $entity: The entity.

Return value

array An array of revision names.

2 calls to ContentModerationSyncingTest::getAllRevisionNames()
ContentModerationSyncingTest::testStateChangedPreviousRevisionDuringSync in core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php
Tests a moderation state changed on a previous revision during a sync.
ContentModerationSyncingTest::testUpdatingPreviousRevisionDuringSync in core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php
Tests modifying a previous revision during a sync.

File

core/modules/content_moderation/tests/src/Kernel/ContentModerationSyncingTest.php, line 194

Class

ContentModerationSyncingTest
Test content moderation when an entity is marked as 'syncing'.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function getAllRevisionNames(EntityTestMulRevPub $entity) {
    
    /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
    $storage = $this->container
        ->get('entity_type.manager')
        ->getStorage('entity_test_mulrevpub');
    return array_map(function ($revision_id) use ($storage) {
        return $storage->loadRevision($revision_id)->name->value;
    }, array_keys($storage->getQuery()
        ->accessCheck(FALSE)
        ->allRevisions()
        ->condition('id', $entity->id())
        ->sort('revision_id', 'ASC')
        ->execute()));
}

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