function MigrateDrupal6AuditIdsTest::testAllMigrationsWithIdConflicts

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testAllMigrationsWithIdConflicts()
  2. 10 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testAllMigrationsWithIdConflicts()
  3. 11.x core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testAllMigrationsWithIdConflicts()

Tests all migrations with ID conflicts.

File

core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php, line 115

Class

MigrateDrupal6AuditIdsTest
Tests the migration auditor for ID conflicts.

Namespace

Drupal\Tests\migrate_drupal\Kernel\d6

Code

public function testAllMigrationsWithIdConflicts() {
    // Get all Drupal 6 migrations.
    $migrations = $this->container
        ->get('plugin.manager.migration')
        ->createInstancesByTag('Drupal 6');
    // Create content.
    $this->createContent();
    // Audit the IDs of all migrations. There should be conflicts since content
    // has been created.
    $conflicts = array_map(function (AuditResult $result) {
        return $result->passed() ? NULL : $result->getMigration()
            ->getBaseId();
    }, (new IdAuditor())->auditMultiple($migrations));
    $expected = [
        'd6_aggregator_feed',
        'd6_aggregator_item',
        'd6_comment',
        'd6_custom_block',
        'd6_file',
        'd6_menu_links',
        'd6_node',
        'd6_node_complete',
        'd6_node_revision',
        'd6_taxonomy_term',
        'd6_term_node_revision',
        'd6_user',
        'node_translation_menu_links',
    ];
    $this->assertEmpty(array_diff(array_filter($conflicts), $expected));
}

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