function StorageComparerTest::testCreateChangelistDelete

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

@covers ::createChangelist

File

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

Class

StorageComparerTest
@coversDefaultClass \Drupal\Core\Config\StorageComparer[[api-linebreak]] @group Config

Namespace

Drupal\Tests\Core\Config

Code

public function testCreateChangelistDelete() : void {
  $target_data = $source_data = $this->getConfigData();
  unset($source_data['field.storage.node.body']);
  unset($source_data['field.field.node.article.body']);
  unset($source_data['views.view.test_view']);
  $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();
  $expected = [
    'views.view.test_view',
    'field.field.node.article.body',
    'field.storage.node.body',
  ];
  $this->assertEquals($expected, $this->storageComparer
    ->getChangelist('delete'));
  $this->assertEmpty($this->storageComparer
    ->getChangelist('create'));
  $this->assertEmpty($this->storageComparer
    ->getChangelist('update'));
}

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