function EntityWorkspaceConflictConstraintValidatorTest::reloadEntity

Same name in other branches
  1. 10 core/modules/workspaces/tests/src/Kernel/EntityWorkspaceConflictConstraintValidatorTest.php \Drupal\Tests\workspaces\Kernel\EntityWorkspaceConflictConstraintValidatorTest::reloadEntity()

Reloads the given entity from the storage and returns it.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be reloaded.

Return value

\Drupal\Core\Entity\EntityInterface The reloaded entity.

1 call to EntityWorkspaceConflictConstraintValidatorTest::reloadEntity()
EntityWorkspaceConflictConstraintValidatorTest::testNewEntitiesAllowedInDefaultWorkspace in core/modules/workspaces/tests/src/Kernel/EntityWorkspaceConflictConstraintValidatorTest.php
@covers ::validate

File

core/modules/workspaces/tests/src/Kernel/EntityWorkspaceConflictConstraintValidatorTest.php, line 141

Class

EntityWorkspaceConflictConstraintValidatorTest
@coversDefaultClass \Drupal\workspaces\Plugin\Validation\Constraint\EntityWorkspaceConflictConstraintValidator @group workspaces

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function reloadEntity(EntityInterface $entity) : EntityInterface {
    $storage = $this->entityTypeManager
        ->getStorage($entity->getEntityTypeId());
    $storage->resetCache([
        $entity->id(),
    ]);
    return $storage->load($entity->id());
}

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