function ConfigEntityStorageTest::testCreateWithPredefinedUuid
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
- 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
@covers ::create @covers ::doCreate
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 173
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testCreateWithPredefinedUuid() : void {
$this->cacheTagsInvalidator
->invalidateTags(Argument::cetera())
->shouldNotBeCalled();
$entity = $this->getMockEntity();
$entity->set('id', 'foo');
$entity->set('langcode', 'hu');
$entity->set('uuid', 'baz');
$entity->setOriginalId('foo');
$entity->enforceIsNew();
$this->moduleHandler
->invokeAll('test_entity_type_create', [
$entity,
])
->shouldBeCalled();
$this->moduleHandler
->invokeAll('entity_create', [
$entity,
'test_entity_type',
])
->shouldBeCalled();
$this->uuidService
->generate()
->shouldNotBeCalled();
$entity = $this->entityStorage
->create([
'id' => 'foo',
'uuid' => 'baz',
]);
$this->assertInstanceOf(EntityInterface::class, $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.