Loading core/lib/Drupal/Core/Config/StorageComparer.php +1 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,7 @@ protected function addChangelistUpdate($collection) { $source_data = $this->getSourceStorage($collection)->read($name); $target_data = $this->getTargetStorage($collection)->read($name); if ($source_data !== $target_data) { if (isset($source_data['uuid']) && $source_data['uuid'] !== $target_data['uuid']) { if (isset($source_data['uuid']) && $source_data['uuid'] !== ($target_data['uuid'] ?? NULL)) { // The entity has the same file as an existing entity but the UUIDs do // not match. This means that the entity has been recreated so config // synchronization should do the same. Loading core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php +39 −0 Original line number Diff line number Diff line Loading @@ -291,6 +291,45 @@ public function testDifferentCollections(): void { } } /** * @legacy-covers ::createChangelist */ public function testChangelistUuidMissMatch(): void { $target_data = $source_data = $this->getConfigData(); unset($target_data['views.view.test_view']['uuid']); $target_data['field.storage.node.body']['uuid'] = (new Php())->generate(); $this->sourceStorage->expects($this->once()) ->method('listAll') ->willReturn(array_keys($source_data)); $this->targetStorage->expects($this->once()) ->method('listAll') ->willReturn(array_keys($target_data)); $this->sourceStorage->expects($this->once()) ->method('readMultiple') ->willReturn($source_data); $this->targetStorage->expects($this->once()) ->method('readMultiple') ->willReturn($target_data); $this->sourceStorage->expects($this->once()) ->method('getAllCollectionNames') ->willReturn([]); $this->targetStorage->expects($this->once()) ->method('getAllCollectionNames') ->willReturn([]); $this->storageComparer->createChangelist(); $recreate_expected = [ 'field.storage.node.body', 'views.view.test_view', ]; // Recreating these because of uuid differences. This shows up as a create // and delete operation. $this->assertEqualsCanonicalizing($recreate_expected, $this->storageComparer->getChangelist('create')); $this->assertEqualsCanonicalizing($recreate_expected, $this->storageComparer->getChangelist('delete')); $this->assertEquals([], $this->storageComparer->getChangelist('update')); } /** * Generate random data in a config storage. * Loading Loading
core/lib/Drupal/Core/Config/StorageComparer.php +1 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,7 @@ protected function addChangelistUpdate($collection) { $source_data = $this->getSourceStorage($collection)->read($name); $target_data = $this->getTargetStorage($collection)->read($name); if ($source_data !== $target_data) { if (isset($source_data['uuid']) && $source_data['uuid'] !== $target_data['uuid']) { if (isset($source_data['uuid']) && $source_data['uuid'] !== ($target_data['uuid'] ?? NULL)) { // The entity has the same file as an existing entity but the UUIDs do // not match. This means that the entity has been recreated so config // synchronization should do the same. Loading
core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php +39 −0 Original line number Diff line number Diff line Loading @@ -291,6 +291,45 @@ public function testDifferentCollections(): void { } } /** * @legacy-covers ::createChangelist */ public function testChangelistUuidMissMatch(): void { $target_data = $source_data = $this->getConfigData(); unset($target_data['views.view.test_view']['uuid']); $target_data['field.storage.node.body']['uuid'] = (new Php())->generate(); $this->sourceStorage->expects($this->once()) ->method('listAll') ->willReturn(array_keys($source_data)); $this->targetStorage->expects($this->once()) ->method('listAll') ->willReturn(array_keys($target_data)); $this->sourceStorage->expects($this->once()) ->method('readMultiple') ->willReturn($source_data); $this->targetStorage->expects($this->once()) ->method('readMultiple') ->willReturn($target_data); $this->sourceStorage->expects($this->once()) ->method('getAllCollectionNames') ->willReturn([]); $this->targetStorage->expects($this->once()) ->method('getAllCollectionNames') ->willReturn([]); $this->storageComparer->createChangelist(); $recreate_expected = [ 'field.storage.node.body', 'views.view.test_view', ]; // Recreating these because of uuid differences. This shows up as a create // and delete operation. $this->assertEqualsCanonicalizing($recreate_expected, $this->storageComparer->getChangelist('create')); $this->assertEqualsCanonicalizing($recreate_expected, $this->storageComparer->getChangelist('delete')); $this->assertEquals([], $this->storageComparer->getChangelist('update')); } /** * Generate random data in a config storage. * Loading