You are here

protected function MigrateMessageTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::setUp()
  2. 9 core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::setUp()

File

core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php, line 44

Class

MigrateMessageTest
Tests whether idmap messages are sent to message interface when requested.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'system',
  ]);

  // A simple migration, which will generate a message to the ID map because
  // the concat plugin throws an exception if its source is not an array.
  $definition = [
    'migration_tags' => [
      'Message test',
    ],
    'source' => [
      'plugin' => 'embedded_data',
      'data_rows' => [
        [
          'name' => 'source_message',
          'value' => 'a message',
        ],
      ],
      'ids' => [
        'name' => [
          'type' => 'string',
        ],
      ],
    ],
    'process' => [
      'message' => [
        'plugin' => 'concat',
        'source' => 'value',
      ],
    ],
    'destination' => [
      'plugin' => 'config',
      'config_name' => 'system.maintenance',
    ],
  ];
  $this->migration = \Drupal::service('plugin.manager.migration')
    ->createStubMigration($definition);
}