You are here

public function KeyValueEntityStorageTest::testSaveInvalid 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::testSaveInvalid()

@covers ::save @covers ::doSave

@expectedException \Drupal\Core\Entity\EntityMalformedException @expectedExceptionMessage The entity does not have an ID.

File

core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php, line 451
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 testSaveInvalid() {
  $this
    ->setUpKeyValueEntityStorage();
  $entity = $this
    ->getMockEntity('Drupal\\Core\\Config\\Entity\\ConfigEntityBase');
  $this->entityStorage
    ->save($entity);
  $this->keyValueStore
    ->expects($this
    ->never())
    ->method('has');
  $this->keyValueStore
    ->expects($this
    ->never())
    ->method('set');
  $this->keyValueStore
    ->expects($this
    ->never())
    ->method('delete');
}