function StorageComparerTest::testCreateChangelistUpdate

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php \Drupal\Tests\Core\Config\StorageComparerTest::testCreateChangelistUpdate()
  2. 10 core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php \Drupal\Tests\Core\Config\StorageComparerTest::testCreateChangelistUpdate()
  3. 11.x core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php \Drupal\Tests\Core\Config\StorageComparerTest::testCreateChangelistUpdate()

@covers ::createChangelist

File

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

Class

StorageComparerTest
@coversDefaultClass \Drupal\Core\Config\StorageComparer @group Config

Namespace

Drupal\Tests\Core\Config

Code

public function testCreateChangelistUpdate() {
    $target_data = $source_data = $this->getConfigData();
    $source_data['system.site']['title'] = 'Drupal New!';
    $source_data['field.field.node.article.body']['new_config_key'] = 'new data';
    $source_data['field.storage.node.body']['new_config_key'] = 'new data';
    $this->sourceStorage
        ->expects($this->once())
        ->method('listAll')
        ->will($this->returnValue(array_keys($source_data)));
    $this->targetStorage
        ->expects($this->once())
        ->method('listAll')
        ->will($this->returnValue(array_keys($target_data)));
    $this->sourceStorage
        ->expects($this->once())
        ->method('readMultiple')
        ->will($this->returnValue($source_data));
    $this->targetStorage
        ->expects($this->once())
        ->method('readMultiple')
        ->will($this->returnValue($target_data));
    $this->sourceStorage
        ->expects($this->once())
        ->method('getAllCollectionNames')
        ->will($this->returnValue([]));
    $this->targetStorage
        ->expects($this->once())
        ->method('getAllCollectionNames')
        ->will($this->returnValue([]));
    $this->storageComparer
        ->createChangelist();
    $expected = [
        'field.storage.node.body',
        'field.field.node.article.body',
        'system.site',
    ];
    $this->assertEquals($expected, $this->storageComparer
        ->getChangelist('update'));
    $this->assertEmpty($this->storageComparer
        ->getChangelist('create'));
    $this->assertEmpty($this->storageComparer
        ->getChangelist('delete'));
}

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