public function ConfigEntityStorageTest::testSaveChangedUuid in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveChangedUuid()
- 10 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 508
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testSaveChangedUuid() {
$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->moduleHandler
->getImplementations('entity_load')
->willReturn([]);
$this->moduleHandler
->getImplementations('test_entity_type_load')
->willReturn([]);
$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);
}