You are here

public function KeyValueEntityStorageTest::testDelete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 620
Contains \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest.

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\\Entity', array(
    array(
      'id' => 'foo',
    ),
  ));
  $entities['bar'] = $this
    ->getMockEntity('Drupal\\Core\\Entity\\Entity', array(
    array(
      '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(array(
    'foo',
    'bar',
  ));
  $this->entityStorage
    ->delete($entities);
}