public function ConfigEntityStorageTest::testDelete in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testDelete()
- 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testDelete()
@covers ::delete @covers ::doDelete
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 661
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testDelete() {
// Dependencies are tested in
// \Drupal\Tests\config\Kernel\ConfigDependencyTest.
$this->configManager
->getConfigEntitiesToChangeOnDependencyRemoval('config', [
'the_provider.the_config_prefix.foo',
], FALSE)
->willReturn([
'update' => [],
'delete' => [],
'unchanged' => [],
]);
$this->configManager
->getConfigEntitiesToChangeOnDependencyRemoval('config', [
'the_provider.the_config_prefix.bar',
], FALSE)
->willReturn([
'update' => [],
'delete' => [],
'unchanged' => [],
]);
$entities = [];
foreach ([
'foo',
'bar',
] as $id) {
$entity = $this
->getMockEntity([
'id' => $id,
]);
$entities[] = $entity;
$config_object = $this
->prophesize(Config::class);
$config_object
->delete()
->shouldBeCalled();
$this->configFactory
->getEditable("the_provider.the_config_prefix.{$id}")
->willReturn($config_object
->reveal());
$this->moduleHandler
->invokeAll('test_entity_type_predelete', [
$entity,
])
->shouldBeCalled();
$this->moduleHandler
->invokeAll('entity_predelete', [
$entity,
'test_entity_type',
])
->shouldBeCalled();
$this->moduleHandler
->invokeAll('test_entity_type_delete', [
$entity,
])
->shouldBeCalled();
$this->moduleHandler
->invokeAll('entity_delete', [
$entity,
'test_entity_type',
])
->shouldBeCalled();
}
$this->cacheTagsInvalidator
->invalidateTags([
$this->entityTypeId . '_list',
])
->shouldBeCalled();
$this->entityStorage
->delete($entities);
}