function ConfigEntityStorageTest::testSaveNoMismatch
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveNoMismatch()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveNoMismatch()
- 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testSaveNoMismatch()
@covers ::save @covers ::doSave
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 471
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testSaveNoMismatch() : void {
$immutable_config_object = $this->prophesize(ImmutableConfig::class);
$immutable_config_object->isNew()
->willReturn(TRUE);
$config_object = $this->prophesize(Config::class);
$config_object->get()
->willReturn([]);
$config_object->setData([
'id' => 'foo',
'uuid' => NULL,
'dependencies' => [],
'langcode' => 'en',
'status' => TRUE,
])
->shouldBeCalled();
$config_object->save(FALSE)
->shouldBeCalled();
$this->cacheTagsInvalidator
->invalidateTags([
$this->entityTypeId . '_list',
])
->shouldBeCalled();
$this->configFactory
->get('the_provider.the_config_prefix.baz')
->willReturn($immutable_config_object->reveal())
->shouldBeCalled();
$this->configFactory
->rename('the_provider.the_config_prefix.baz', 'the_provider.the_config_prefix.foo')
->shouldBeCalled();
$this->configFactory
->getEditable('the_provider.the_config_prefix.foo')
->willReturn($config_object->reveal())
->shouldBeCalled();
$this->entityQuery
->condition('uuid', NULL)
->willReturn($this->entityQuery);
$this->entityQuery
->execute()
->willReturn([
'baz',
]);
$entity = $this->getMockEntity([
'id' => 'foo',
]);
$entity->setOriginalId('baz');
$entity->enforceIsNew();
$this->entityStorage
->save($entity);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.