public function StateFileExistsTest::testMigrationState in Drupal 10
Tests that the migrate_drupal.yml files exist as needed.
File
- core/
modules/ migrate_drupal/ tests/ src/ Kernel/ StateFileExistsTest.php, line 85
Class
- StateFileExistsTest
- 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);
}