function MigrateEventsTest::setUp

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

Overrides KernelTestBase::setUp

File

core/modules/migrate/tests/src/Kernel/MigrateEventsTest.php, line 38

Class

MigrateEventsTest
Tests events fired on migrations.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->state = \Drupal::state();
    \Drupal::service('event_dispatcher')->addListener(MigrateEvents::MAP_SAVE, [
        $this,
        'mapSaveEventRecorder',
    ]);
    \Drupal::service('event_dispatcher')->addListener(MigrateEvents::MAP_DELETE, [
        $this,
        'mapDeleteEventRecorder',
    ]);
    \Drupal::service('event_dispatcher')->addListener(MigrateEvents::PRE_IMPORT, [
        $this,
        'preImportEventRecorder',
    ]);
    \Drupal::service('event_dispatcher')->addListener(MigrateEvents::POST_IMPORT, [
        $this,
        'postImportEventRecorder',
    ]);
    \Drupal::service('event_dispatcher')->addListener(MigrateEvents::PRE_ROW_SAVE, [
        $this,
        'preRowSaveEventRecorder',
    ]);
    \Drupal::service('event_dispatcher')->addListener(MigrateEvents::POST_ROW_SAVE, [
        $this,
        'postRowSaveEventRecorder',
    ]);
}

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