coreModuleListDataProvider example


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();
      
$id = $definition['id'];
      $this->assertArrayHasKey('source_module', $definition, "No source_module property in '$id'");
    }
  }

  /** * Enable all available modules. */
  protected function enableAllModules() {
    // 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);
  }

  /** * Tests that modules exist for all field plugins. */
  public function testFieldProvidersExist() {
    $expected_mappings = [
      'userreference' => [
        

class MigrationProcessTest extends MigrateDrupal7TestBase {

  use FileSystemModuleDiscoveryDataProviderTrait;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    self::$modules = array_keys($this->coreModuleListDataProvider());
    parent::setUp();
  }

  /** * Tests that calling getProcess() on a migration does not throw an exception. * * @throws \Exception */
  public function testGetProcess() {
    /** @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager */
    $plugin_manager = $this->container->get('plugin.manager.migration');
    
    'tracker',
    'update',
    'user',
  ];

  /** * Tests that the migrate_drupal.yml files exist as needed. */
  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 D$value) {
      return $value . '/migrations/state';
    }$module_handler->getModuleDirectories())))->findAll();

    foreach ($this->stateFileRequired as $module) {
      $this->assertArrayHasKey($module$has_state_filesprintf("Module '%s' should have a migrate_drupal.yml file", $module));
    }

  protected $migrationManager;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    // Enable all modules.     self::$modules = array_keys($this->coreModuleListDataProvider());
    parent::setUp();
    $this->migrationManager = \Drupal::service('plugin.manager.migration');
  }

  /** * Tests that all D6 migrations are tagged as either Configuration or Content. */
  public function testD6Categories() {
    $migrations = $this->drupal6Migrations();
    $this->assertArrayHasKey('d6_node:page', $migrations);
    $this->assertCategories($migrations);
  }
class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {

  use FileSystemModuleDiscoveryDataProviderTrait;
  use CreateTestContentEntitiesTrait;
  use ContentModerationTestTrait;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    // Enable all modules.     self::$modules = array_keys($this->coreModuleListDataProvider());
    parent::setUp();

    // Install required entity schemas.     $this->installEntitySchemas();

    // Install required schemas.     $this->installSchema('book', ['book']);
    $this->installSchema('dblog', ['watchdog']);
    // @todo Remove forum in https://www.drupal.org/project/drupal/issues/3261653     $this->installSchema('forum', ['forum_index']);
    $this->installSchema('node', ['node_access']);
    
/** * A data provider that lists every module in core. * * Also adds a deprecated module with config. * * @return string[][] * An array of module names to test, with both key and value being the name * of the module. */
  public function moduleListDataProvider() {
    $modules_keyed = $this->coreModuleListDataProvider();

    // Add a deprecated module with config.     $modules_keyed['deprecated_module'] = ['deprecated_module'];

    return $modules_keyed;
  }

  /** * Tests that default config matches the installed config. * * @param \Drupal\Core\Config\StorageInterface $default_config_storage * The default config storage to test. * @param string $extension * The extension that is being tested. * @param string $type * The extension type to test. */
class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {

  use FileSystemModuleDiscoveryDataProviderTrait;
  use CreateTestContentEntitiesTrait;
  use ContentModerationTestTrait;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    // Enable all modules.     self::$modules = array_keys($this->coreModuleListDataProvider());
    parent::setUp();

    // Install required entity schemas.     $this->installEntitySchemas();

    // Install required schemas.     $this->installSchema('book', ['book']);
    $this->installSchema('dblog', ['watchdog']);
    // @todo Remove forum in https://www.drupal.org/project/drupal/issues/3261653     $this->installSchema('forum', ['forum_index']);
    $this->installSchema('node', ['node_access']);
    
$data = str_getcsv($datum);
      $this->assertContains($datum$declared_unique[MigrationState::NOT_FINISHED]sprintf("No migration found for version '%s' with source_module '%s' and destination_module '%s' declared in module '%s'", $version$data[1]$data[2]$data[0]));
    }
  }

  /** * Enable all available modules. */
  protected function enableAllModules() {
    // 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);
    return $modules;
  }

}

class MigrationProcessTest extends MigrateDrupal6TestBase {

  use FileSystemModuleDiscoveryDataProviderTrait;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    self::$modules = array_keys($this->coreModuleListDataProvider());
    parent::setUp();
  }

  /** * Tests that calling getProcess() on a migration does not throw an exception. * * @throws \Exception */
  public function testGetProcess() {
    /** @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager */
    $plugin_manager = $this->container->get('plugin.manager.migration');
    
Home | Imprint | This part of the site doesn't use cookies.