public function ConfigEntityStorageTest::testCreateWithPredefinedUuid in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
- 9 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 170
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testCreateWithPredefinedUuid() {
$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());
}