diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php index 256e469..a0bb591 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6AuditIdsTest.php @@ -173,4 +173,24 @@ public function testDraftRevisionIdConflicts() { $this->assertFalse($result->passed()); } + /** + * Tests ID conflicts for inaccessible nodes. + */ + 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()); + } + } diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php index 377985a..1d74423 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php @@ -172,4 +172,24 @@ public function testDraftRevisionIdConflicts() { $this->assertFalse($result->passed()); } + /** + * Tests ID conflicts for inaccessible nodes. + */ + 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 d7_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('d7_node:page')); + $this->assertInstanceOf(AuditResult::class, $result); + $this->assertFalse($result->passed()); + } + }