148c9bee294cec565662b8d59a7c25a211eedffb
[yaffs-website] / web / core / modules / migrate_drupal_ui / tests / src / Kernel / MigrationLabelExistTest.php
1 <?php
2
3 namespace Drupal\Tests\migrate_drupal_ui\Kernel;
4
5 use Drupal\Component\Render\FormattableMarkup;
6 use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
7 use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
8
9 /**
10  * Tests that labels exist for all migrations.
11  *
12  * @group migrate_drupal_ui
13  */
14 class MigrationLabelExistTest extends MigrateDrupalTestBase {
15
16   use FileSystemModuleDiscoveryDataProviderTrait;
17
18   /**
19    * Tests that labels exist for all migrations.
20    */
21   public function testLabelExist() {
22     // Install all available modules.
23     $module_handler = $this->container->get('module_handler');
24     $modules = $this->coreModuleListDataProvider();
25     $modules_enabled = $module_handler->getModuleList();
26     $modules_to_enable = array_keys(array_diff_key($modules, $modules_enabled));
27     $this->enableModules($modules_to_enable);
28
29     /** @var \Drupal\migrate\Plugin\MigrationPluginManager $plugin_manager */
30     $plugin_manager = $this->container->get('plugin.manager.migration');
31     // Get all the migrations
32     $migrations = $plugin_manager->createInstances(array_keys($plugin_manager->getDefinitions()));
33     /** @var \Drupal\migrate\Plugin\Migration $migration */
34     foreach ($migrations as $migration) {
35       $migration_id = $migration->getPluginId();
36       $this->assertNotEmpty($migration->label(), new FormattableMarkup('Label found for @migration_id.', ['@migration_id' => $migration_id]));
37     }
38   }
39
40 }