You are here

public function MigrateDrupal6AuditIdsTest::testNodeGrantsIdConflicts in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testNodeGrantsIdConflicts()
  2. 9 core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php \Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6AuditIdsTest::testNodeGrantsIdConflicts()

Tests ID conflicts for inaccessible nodes.

File

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

Class

MigrateDrupal6AuditIdsTest
Tests the migration auditor for ID conflicts.

Namespace

Drupal\Tests\migrate_drupal\Kernel\d6

Code

public function testNodeGrantsIdConflicts() {

  // Enable the node_test module to restrict access to page nodes.
  $this
    ->enableModules([
    'node_test',
  ]);

  // Create a published node of type page.
  $node = Node::create([
    'type' => 'page',
    'title' => 'foo',
  ]);
  $node->moderation_state->value = 'published';
  $node
    ->save();

  // Audit the IDs of the d6_node migration. There should be conflicts
  // even though the new node is not accessible.

  /** @var \Drupal\migrate\Audit\AuditResult $result */
  $result = (new IdAuditor())
    ->audit($this
    ->getMigration('d6_node:page'));
  $this
    ->assertInstanceOf(AuditResult::class, $result);
  $this
    ->assertFalse($result
    ->passed());
}