function StorageComparerTest::testDifferentCollections
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php \Drupal\Tests\Core\Config\StorageComparerTest::testDifferentCollections()
- 11.x core/tests/Drupal/Tests/Core/Config/StorageComparerTest.php \Drupal\Tests\Core\Config\StorageComparerTest::testDifferentCollections()
@covers ::createChangelist
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ StorageComparerTest.php, line 257
Class
- StorageComparerTest
- @coversDefaultClass \Drupal\Core\Config\StorageComparer @group Config
Namespace
Drupal\Tests\Core\ConfigCode
public function testDifferentCollections() {
$source = new MemoryStorage();
$target = new MemoryStorage();
$this->generateRandomData($source, 's');
$this->generateRandomData($target, 't');
// Use random collections for source and target.
$collections = $source->getAllCollectionNames();
$source = $source->createCollection($collections[array_rand($collections)]);
$collections = $target->getAllCollectionNames();
$target = $target->createCollection($collections[array_rand($collections)]);
$comparer = new StorageComparer($source, $target);
$comparer->createChangelist();
foreach (array_merge([
StorageInterface::DEFAULT_COLLECTION,
], $source->getAllCollectionNames(), $target->getAllCollectionNames()) as $collection) {
$expected = [
'create' => $source->createCollection($collection)
->listAll(),
'update' => [],
'delete' => $target->createCollection($collection)
->listAll(),
'rename' => [],
];
$this->assertEqualsCanonicalizing($expected, $comparer->getChangelist(NULL, $collection));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.