class MigrationLabelExistTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate_drupal_ui/tests/src/Kernel/MigrationLabelExistTest.php \Drupal\Tests\migrate_drupal_ui\Kernel\MigrationLabelExistTest
- 9 core/modules/migrate_drupal_ui/tests/src/Kernel/MigrationLabelExistTest.php \Drupal\Tests\migrate_drupal_ui\Kernel\MigrationLabelExistTest
Tests that labels exist for all migrations.
@group migrate_drupal_ui
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements MigrateMessageInterface
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal_ui\Kernel\MigrationLabelExistTest uses FileSystemModuleDiscoveryDataProviderTrait
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements MigrateMessageInterface
Expanded class hierarchy of MigrationLabelExistTest
File
- core/
modules/ migrate_drupal_ui/ tests/ src/ Kernel/ MigrationLabelExistTest.php, line 14
Namespace
Drupal\Tests\migrate_drupal_ui\KernelView source
class MigrationLabelExistTest extends MigrateDrupalTestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
/**
* Tests that labels exist for all migrations.
*/
public function testLabelExist() {
// Install all available modules.
$module_handler = $this->container
->get('module_handler');
$modules = $this
->coreModuleListDataProvider();
$modules_enabled = $module_handler
->getModuleList();
$modules_to_enable = array_keys(array_diff_key($modules, $modules_enabled));
$this
->enableModules($modules_to_enable);
/** @var \Drupal\migrate\Plugin\MigrationPluginManager $plugin_manager */
$plugin_manager = $this->container
->get('plugin.manager.migration');
// Get all the migrations
$migrations = $plugin_manager
->createInstances(array_keys($plugin_manager
->getDefinitions()));
/** @var \Drupal\migrate\Plugin\Migration $migration */
foreach ($migrations as $migration) {
$migration_id = $migration
->getPluginId();
$this
->assertNotEmpty($migration
->label(), new FormattableMarkup('Label found for @migration_id.', [
'@migration_id' => $migration_id,
]));
}
}
}