function KeyValueEntityStorageTest::testDelete
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testDelete()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testDelete()
- 10 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testDelete()
@covers ::delete @covers ::doDelete
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorageTest.php, line 560
Class
- KeyValueEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\KeyValueStoreCode
public function testDelete() : void {
$entities['foo'] = $this->getMockEntity(EntityBaseTest::class, [
[
'id' => 'foo',
],
]);
$entities['bar'] = $this->getMockEntity(EntityBaseTest::class, [
[
'id' => 'bar',
],
]);
$this->setUpKeyValueEntityStorage();
$hooks = [
'test_entity_type_predelete',
'entity_predelete',
'test_entity_type_predelete',
'entity_predelete',
'test_entity_type_delete',
'entity_delete',
'test_entity_type_delete',
'entity_delete',
];
$this->moduleHandler
->expects($this->exactly(count($hooks)))
->method('invokeAll')
->with($this->callback(function (string $hook) use (&$hooks) : bool {
return array_shift($hooks) === $hook;
}));
$this->keyValueStore
->expects($this->once())
->method('deleteMultiple')
->with([
'foo',
'bar',
]);
$this->entityStorage
->delete($entities);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.