public function StateFileExists::testMigrationState in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate_drupal/tests/src/Kernel/StateFileExists.php \Drupal\Tests\migrate_drupal\Kernel\StateFileExists::testMigrationState()
Tests that the migrate_drupal.yml files exist as needed.
File
- core/
modules/ migrate_drupal/ tests/ src/ Kernel/ StateFileExists.php, line 86
Class
- StateFileExists
- Tests that core modules have a migrate_drupal.yml file as needed.
Namespace
Drupal\Tests\migrate_drupal\KernelCode
public function testMigrationState() {
// Install all available modules.
$module_handler = $this->container
->get('module_handler');
$all_modules = $this
->coreModuleListDataProvider();
$modules_enabled = $module_handler
->getModuleList();
$modules_to_enable = array_keys(array_diff_key($all_modules, $modules_enabled));
$this
->enableModules($modules_to_enable);
// Modules with a migrate_drupal.yml file.
$has_state_file = (new YamlDiscovery('migrate_drupal', array_map(function ($value) {
return $value . '/migrations/state';
}, $module_handler
->getModuleDirectories())))
->findAll();
foreach ($this->stateFileRequired as $module) {
$this
->assertArrayHasKey($module, $has_state_file, sprintf("Module '%s' should have a migrate_drupal.yml file", $module));
}
$this
->assertSameSize($this->stateFileRequired, $has_state_file);
}