function KeyValueEntityStorageTest::testCreateWithPredefinedUuid
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testCreateWithPredefinedUuid()
- 10 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testCreateWithPredefinedUuid()
- 11.x core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testCreateWithPredefinedUuid()
@covers ::create @covers ::doCreate
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorageTest.php, line 152
Class
- KeyValueEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\KeyValueStoreCode
public function testCreateWithPredefinedUuid() {
$this->entityType
->expects($this->once())
->method('getClass')
->will($this->returnValue(get_class($this->getMockEntity())));
$this->setUpKeyValueEntityStorage();
$this->moduleHandler
->expects($this->at(0))
->method('invokeAll')
->with('test_entity_type_create');
$this->moduleHandler
->expects($this->at(1))
->method('invokeAll')
->with('entity_create');
$this->uuidService
->expects($this->never())
->method('generate');
$entity = $this->entityStorage
->create([
'id' => 'foo',
'uuid' => 'baz',
]);
$this->assertInstanceOf('Drupal\\Core\\Entity\\EntityInterface', $entity);
$this->assertSame('foo', $entity->id());
$this->assertSame('baz', $entity->uuid());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.