public function KeyValueEntityStorageTest::testDelete in Drupal 8
@covers ::delete @covers ::doDelete
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorageTest.php, line 628
Class
- KeyValueEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\KeyValueStoreCode
public function testDelete() {
$entities['foo'] = $this
->getMockEntity('Drupal\\Core\\Entity\\EntityBase', [
[
'id' => 'foo',
],
]);
$entities['bar'] = $this
->getMockEntity('Drupal\\Core\\Entity\\EntityBase', [
[
'id' => 'bar',
],
]);
$this->entityType
->expects($this
->once())
->method('getClass')
->will($this
->returnValue(get_class(reset($entities))));
$this
->setUpKeyValueEntityStorage();
$this->moduleHandler
->expects($this
->at(0))
->method('invokeAll')
->with('test_entity_type_predelete');
$this->moduleHandler
->expects($this
->at(1))
->method('invokeAll')
->with('entity_predelete');
$this->moduleHandler
->expects($this
->at(2))
->method('invokeAll')
->with('test_entity_type_predelete');
$this->moduleHandler
->expects($this
->at(3))
->method('invokeAll')
->with('entity_predelete');
$this->moduleHandler
->expects($this
->at(4))
->method('invokeAll')
->with('test_entity_type_delete');
$this->moduleHandler
->expects($this
->at(5))
->method('invokeAll')
->with('entity_delete');
$this->moduleHandler
->expects($this
->at(6))
->method('invokeAll')
->with('test_entity_type_delete');
$this->moduleHandler
->expects($this
->at(7))
->method('invokeAll')
->with('entity_delete');
$this->keyValueStore
->expects($this
->once())
->method('deleteMultiple')
->with([
'foo',
'bar',
]);
$this->entityStorage
->delete($entities);
}