MigrationProcessTest.php 1.3 KB
Newer Older
1 2 3 4 5
<?php

namespace Drupal\Tests\migrate_drupal\Kernel\d6;

use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
6
use Drupal\Tests\DeprecatedModulesTestTrait;
7 8 9 10 11 12 13

/**
 * Tests the getProcess() method of all Drupal 6 migrations.
 *
 * @group migrate_drupal
 */
class MigrationProcessTest extends MigrateDrupal6TestBase {
14 15

  use DeprecatedModulesTestTrait;
16 17 18 19 20 21 22
  use FileSystemModuleDiscoveryDataProviderTrait;

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    self::$modules = array_keys($this->coreModuleListDataProvider());
23
    self::$modules = $this->removeDeprecatedModules(self::$modules);
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    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');
    $migrations = $plugin_manager->createInstancesByTag('Drupal 6');
    foreach ($migrations as $migration) {
      try {
        $process = $migration->getProcess();
      }
      catch (\Exception $e) {
        $this->fail(sprintf("Migration %s process failed with error: %s", $migration->label(), $e->getMessage()));
      }
      $this->assertNotNull($process);
    }
  }

}