function MigrateNodeCompleteTest::testRollbackNodeComplete
Same name in other branches
- 9 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::testRollbackNodeComplete()
- 10 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::testRollbackNodeComplete()
- 11.x core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest::testRollbackNodeComplete()
Tests rollback of the complete node migration.
File
-
core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d7/ MigrateNodeCompleteTest.php, line 133
Class
- MigrateNodeCompleteTest
- Test class for a complete node migration for Drupal 7.
Namespace
Drupal\Tests\node\Kernel\Migrate\d7Code
public function testRollbackNodeComplete() {
$db = \Drupal::database();
$node_types = [
'article',
'blog',
'book',
'forum',
'page',
'test_content_type',
];
foreach ($node_types as $node_type) {
// Execute the rollback.
$this->migration = $this->getMigration("d7_node_complete:{$node_type}");
(new MigrateExecutable($this->migration, $this))
->rollback();
// Assert there are no nodes of node_type.
$count = $db->select('node_field_data')
->condition('type', $node_type)
->countQuery()
->execute()
->fetchField();
$this->assertSame($count, '0', "There are {$count} nodes of type {$node_type}");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.