You are here

protected function WebformMigrateTestBase::executeWebformMigrations in Webform: Migrate 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/Migrate/d7/WebformMigrateTestBase.php \Drupal\Tests\webform_migrate\Kernel\Migrate\d7\WebformMigrateTestBase::executeWebformMigrations()

Executes migrations of the media source database.

Parameters

bool $classic_node_migration: Whether the classic node migration has to be executed or not.

1 call to WebformMigrateTestBase::executeWebformMigrations()
WebformMigrateTest::testWebformMigrations in tests/src/Kernel/Migrate/d7/WebformMigrateTest.php
Tests the migration of webforms and webform submissions.

File

tests/src/Kernel/Migrate/d7/WebformMigrateTestBase.php, line 79

Class

WebformMigrateTestBase
Base class for Webform migration kernel tests.

Namespace

Drupal\Tests\webform_migrate\Kernel\Migrate\d7

Code

protected function executeWebformMigrations(bool $classic_node_migration = FALSE) {

  // The Drupal 8|9 entity revision migration causes a file not found
  // exception without properly migrated files. For this test, it is enough to
  // properly migrate the public files.
  $fs_fixture_path = $this
    ->getFilesystemFixturePath();
  $file_migration = $this
    ->getMigration('d7_file');
  $source = $file_migration
    ->getSourceConfiguration();
  $source['constants']['source_base_path'] = $fs_fixture_path;
  $file_migration
    ->set('source', $source);

  // Ignore errors of migrations that aren't provided by Webform Migrate.
  $this
    ->startCollectingMessages();
  $this
    ->executeMigration($file_migration);
  $this
    ->executeMigrations([
    'd7_view_modes',
    'd7_field',
    'd7_node_type',
    'd7_field_instance',
    'd7_field_formatter_settings',
    'd7_field_instance_widget_settings',
    'd7_filter_format',
    'd7_user_role',
    'd7_user',
    $classic_node_migration ? 'd7_node' : 'd7_node_complete',
  ]);
  $this
    ->stopCollectingMessages();
  $this
    ->startCollectingMessages();
  $this
    ->executeMigrations([
    'd7_webform',
  ]);
  $this
    ->stopCollectingMessages();
  $this
    ->assertEmpty($this->migrateMessages);
  $this
    ->startCollectingMessages();
  $this
    ->executeMigrations([
    'd7_webform_submission',
  ]);
  $this
    ->stopCollectingMessages();
  $this
    ->assertEmpty($this->migrateMessages);
}