You are here

public function SourceProviderTest::testSourceProvider in Drupal 9

Test missing source provider.

@dataProvider providerSourceProvider

File

core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php, line 26

Class

SourceProviderTest
Tests that a missing source provider error message is displayed.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

public function testSourceProvider($path_to_database) {
  $this
    ->loadFixture($this
    ->getModulePath('migrate_drupal') . $path_to_database);
  $session = $this
    ->assertSession();

  // Start the upgrade process.
  $this
    ->submitCredentialForm();

  // Ensure we get errors about missing modules.
  $session
    ->pageTextContains(t('Resolve all issues below to continue the upgrade.'));
  $session
    ->pageTextContains(t('The no_source_module plugin must define the source_module property.'));

  // Uninstall the module causing the missing module error messages.
  $this->container
    ->get('module_installer')
    ->uninstall([
    'migration_provider_test',
  ], TRUE);

  // Restart the upgrade process and test there is no source_module error.
  $this
    ->drupalGet('/upgrade');
  $this
    ->submitForm([], 'Continue');
  $this
    ->submitForm($this->edits, 'Review upgrade');

  // Ensure there are no errors about missing modules from the test module.
  $session
    ->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.'));
  $session
    ->pageTextNotContains(t('Source module not found for migration_provider_test.'));

  // Ensure there are no errors about any other missing migration providers.
  $session
    ->pageTextNotContains(t('module not found'));
}