enableAllModules example


  public function testMigrationState() {

    // Level separator of destination and source properties.     $separator = ',';

    $this->enableAllModules();

    $version = (string) $this->getLegacyDrupalVersion($this->sourceDatabase);

    // Build an array for each migration keyed by provider. The value is a     // string consisting of the version number, the provider, the source_module     // and the destination module.     $discovered = [];
    /** @var \Drupal\migrate\Plugin\MigrationPluginManager $plugin_manager */
    $plugin_manager = $this->container->get('plugin.manager.migration');
    $migrations = $plugin_manager->createInstancesByTag('Drupal ' . $version);
    /** @var \Drupal\migrate\Plugin\Migration $migration */
    
public function testSourceProvider() {
    $this->enableModules(['migration_provider_test']);
    $this->expectException(BadPluginDefinitionException::class);
    $this->expectExceptionMessage('The no_source_module plugin must define the source_module property.');
    $this->container->get('plugin.manager.migration')->getDefinition('migration_provider_no_annotation');
  }

  /** * Tests that modules exist for all source plugins. */
  public function testProvidersExist() {
    $this->enableAllModules();

    /** @var \Drupal\migrate\Plugin\MigrateSourcePluginManager $plugin_manager */
    $plugin_manager = $this->container->get('plugin.manager.migrate.source');

    foreach ($plugin_manager->getDefinitions() as $definition) {
      $id = $definition['id'];
      $this->assertArrayHasKey('source_module', $definition, "No source_module property in '$id'");
    }
  }

  /** * Enable all available modules. */
Home | Imprint | This part of the site doesn't use cookies.