function KeyValueEntityStorageTest::testDelete

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testDelete()
  2. 10 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testDelete()
  3. 11.x 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 565

Class

KeyValueEntityStorageTest
@coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage @group Entity

Namespace

Drupal\Tests\Core\Entity\KeyValueStore

Code

public function testDelete() {
    $entities['foo'] = $this->getMockEntity('Drupal\\Core\\Entity\\EntityBase', [
        [
            'id' => 'foo',
        ],
    ]);
    $entities['bar'] = $this->getMockEntity('Drupal\\Core\\Entity\\EntityBase', [
        [
            'id' => 'bar',
        ],
    ]);
    $this->setUpKeyValueEntityStorage();
    $this->moduleHandler
        ->expects($this->exactly(8))
        ->method('invokeAll')
        ->withConsecutive([
        'test_entity_type_predelete',
    ], [
        'entity_predelete',
    ]);
    $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.