public function MigrationGroupTest::testDelete in Migrate Plus 8.3
Same name and namespace in other branches
- 8.5 tests/src/Kernel/MigrationGroupTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationGroupTest::testDelete()
- 8.2 tests/src/Kernel/MigrationGroupTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationGroupTest::testDelete()
- 8.4 tests/src/Kernel/MigrationGroupTest.php \Drupal\Tests\migrate_plus\Kernel\MigrationGroupTest::testDelete()
Test that deleting a group deletes its migrations.
File
- tests/
src/ Kernel/ MigrationGroupTest.php, line 90
Class
- MigrationGroupTest
- Test migration groups.
Namespace
Drupal\Tests\migrate_plus\KernelCode
public function testDelete() {
/** @var MigrationGroupInterface $migration_group */
$group_configuration = [
'id' => 'test_group',
];
$migration_group = $this->container
->get('entity_type.manager')
->getStorage('migration_group')
->create($group_configuration);
$migration_group
->save();
/** @var \Drupal\migrate_plus\Entity\MigrationInterface $migration */
$migration = $this->container
->get('entity_type.manager')
->getStorage('migration')
->create([
'id' => 'specific_migration',
'migration_group' => 'test_group',
'migration_tags' => [],
'load' => [],
'destination' => [],
'source' => [],
'migration_dependencies' => [],
]);
$migration
->save();
/** @var \Drupal\migrate_plus\Entity\MigrationGroupInterface $loaded_migration_group */
$loaded_migration_group = MigrationGroup::load('test_group');
$loaded_migration_group
->delete();
/** @var \Drupal\migrate_plus\Entity\MigrationInterface $loaded_migration */
$loaded_migration = Migration::load('specific_migration');
$this
->assertNull($loaded_migration);
}