function StorageComparerTest::testChangelistUuidMissMatch

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php \Drupal\Tests\Core\Config\StorageComparerTest::testChangelistUuidMissMatch()

@legacy-covers ::createChangelist

File

core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php, line 298

Class

StorageComparerTest
Tests Drupal\Core\Config\StorageComparer.

Namespace

Drupal\Tests\Core\Config

Code

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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.