function KeyValueEntityStorageTest::testDelete

Same name in other branches
  1. 9 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 628

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->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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.