protected function FieldKernelTestBase::entitySaveReload in Drupal 9
Same name and namespace in other branches
- 8 core/modules/field/tests/src/Kernel/FieldKernelTestBase.php \Drupal\Tests\field\Kernel\FieldKernelTestBase::entitySaveReload()
Saves and reloads an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
Return value
\Drupal\Core\Entity\EntityInterface The entity, freshly reloaded from storage.
8 calls to FieldKernelTestBase::entitySaveReload()
- FieldAttachOtherTest::testEntityCache in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachOtherTest.php - Tests entity cache.
- FieldAttachStorageTest::testEntityCreateBundle in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests entity_bundle_create().
- FieldAttachStorageTest::testEntityDeleteBundle in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests entity_bundle_delete().
- FieldAttachStorageTest::testFieldAttachSaveEmptyData in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests insert and update with empty or NULL fields.
- FieldAttachStorageTest::testFieldAttachSaveEmptyDataDefaultValue in core/
modules/ field/ tests/ src/ Kernel/ FieldAttachStorageTest.php - Tests insert with empty or NULL fields, with default value.
File
- core/
modules/ field/ tests/ src/ Kernel/ FieldKernelTestBase.php, line 138
Class
- FieldKernelTestBase
- Parent class for Field API unit tests.
Namespace
Drupal\Tests\field\KernelCode
protected function entitySaveReload(EntityInterface $entity) {
$entity
->save();
$controller = $this->container
->get('entity_type.manager')
->getStorage($entity
->getEntityTypeId());
$controller
->resetCache();
return $controller
->load($entity
->id());
}