function MigrateMessageTest::setUp

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::setUp()
  2. 10 core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::setUp()
  3. 11.x core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::setUp()

Overrides KernelTestBase::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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.