function RawConfigWriterTrait::writeRawConfigEntity
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Traits/Core/Config/RawConfigWriterTrait.php \Drupal\Tests\Traits\Core\Config\RawConfigWriterTrait::writeRawConfigEntity()
Writes a config entity without using the entity system or schema.
Parameters
\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The config entity to write.
1 call to RawConfigWriterTrait::writeRawConfigEntity()
- ItemsPerPageTest::testItemsPerPage in core/
modules/ views/ tests/ src/ Functional/ Wizard/ ItemsPerPageTest.php - Tests the number of items per page.
File
-
core/
tests/ Drupal/ Tests/ Traits/ Core/ Config/ RawConfigWriterTrait.php, line 38
Class
- RawConfigWriterTrait
- Allows writing raw config data for testing purposes.
Namespace
Drupal\Tests\Traits\Core\ConfigCode
protected function writeRawConfigEntity(ConfigEntityInterface $entity) : void {
$this->writeRawConfig($entity->getConfigDependencyName(), $entity->toArray());
$tags = Cache::mergeTags($entity->getCacheTags(), $entity->getEntityType()
->getListCacheTags(), $entity->getEntityType()
->hasKey('bundle') ? $entity->getEntityType()
->getBundleListCacheTags($entity->bundle()) : []);
if (!empty($tags)) {
\Drupal::service('cache_tags.invalidator')->invalidateTags($tags);
}
\Drupal::entityTypeManager()->getStorage($entity->getEntityTypeId())
->resetCache([
$entity->id(),
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.