function ConfigEntityStorageTest::testSaveChangedUuid
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveChangedUuid()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveChangedUuid()
- 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveChangedUuid()
@covers ::save @covers ::doSave
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 513
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testSaveChangedUuid() : void {
$config_object = $this->prophesize(ImmutableConfig::class);
$config_object->get()
->willReturn([
'id' => 'foo',
]);
$config_object->get('id')
->willReturn('foo');
$config_object->isNew()
->willReturn(FALSE);
$config_object->getName()
->willReturn('foo');
$config_object->getCacheContexts()
->willReturn([]);
$config_object->getCacheTags()
->willReturn([
'config:foo',
]);
$config_object->getCacheMaxAge()
->willReturn(Cache::PERMANENT);
$this->cacheTagsInvalidator
->invalidateTags(Argument::cetera())
->shouldNotBeCalled();
$this->configFactory
->loadMultiple([
'the_provider.the_config_prefix.foo',
])
->willReturn([
$config_object->reveal(),
]);
$this->configFactory
->get('the_provider.the_config_prefix.foo')
->willReturn($config_object->reveal());
$this->configFactory
->rename(Argument::cetera())
->shouldNotBeCalled();
$this->entityQuery
->condition('uuid', 'baz')
->willReturn($this->entityQuery);
$this->entityQuery
->execute()
->willReturn([
'foo',
]);
$entity = $this->getMockEntity([
'id' => 'foo',
]);
$entity->set('uuid', 'baz');
$this->expectException(ConfigDuplicateUUIDException::class);
$this->expectExceptionMessage('when this entity already exists with UUID');
$this->entityStorage
->save($entity);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.