function MigrateDrupal7AuditIdsTest::testNodeGrantsIdConflicts

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

Tests ID conflicts for inaccessible nodes.

File

core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7AuditIdsTest.php, line 187

Class

MigrateDrupal7AuditIdsTest
Tests the migration auditor for ID conflicts.

Namespace

Drupal\Tests\migrate_drupal\Kernel\d7

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 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());
}

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