function ContentModerationStateTest::reloadEntity
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::reloadEntity()
- 8.9.x core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::reloadEntity()
- 10 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::reloadEntity()
Reloads the entity after clearing the static cache.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to reload.
int|bool $revision_id: The specific revision ID to load. Defaults FALSE and just loads the default revision.
Return value
\Drupal\Core\Entity\EntityInterface The reloaded entity.
6 calls to ContentModerationStateTest::reloadEntity()
- ContentModerationStateTest::assertDefaultRevision in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php - Checks the default revision ID and publishing status for an entity.
- ContentModerationStateTest::doTestBasicModeration in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php - Tests basic monolingual content moderation through the API.
- ContentModerationStateTest::doTestContentModerationStateDataRemoval in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php - Tests removal of content moderation state entity.
- ContentModerationStateTest::doTestContentModerationStateRevisionDataRemoval in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php - Tests removal of content moderation state entity revisions.
- ContentModerationStateTest::testExistingContentModerationStateDataRemoval in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php - Tests removal of content moderation state entities for preexisting content.
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php, line 838
Class
- ContentModerationStateTest
- Tests links between a content entity and a content_moderation_state entity.
Namespace
Drupal\Tests\content_moderation\KernelCode
protected function reloadEntity(EntityInterface $entity, $revision_id = FALSE) {
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId());
$storage->resetCache([
$entity->id(),
]);
if ($revision_id) {
return $storage->loadRevision($revision_id);
}
return $storage->load($entity->id());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.