function MigrateMessageTest::mapMessageRecorder

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

Reacts to map message event.

Parameters

\Drupal\migrate\Event\MigrateIdMapMessageEvent $event: The migration event.

string $name: The event name.

File

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

Class

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

Namespace

Drupal\Tests\migrate\Kernel

Code

public function mapMessageRecorder(MigrateIdMapMessageEvent $event, $name) {
    if ($event->getLevel() == MigrationInterface::MESSAGE_NOTICE || $event->getLevel() == MigrationInterface::MESSAGE_INFORMATIONAL) {
        $type = 'status';
    }
    else {
        $type = 'error';
    }
    $source_id_string = implode(',', $event->getSourceIdValues());
    $this->display($source_id_string . ': ' . $event->getMessage(), $type);
}

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