You are here

public function MigrateMessageTest::mapMessageRecorder in Drupal 9

Same name and namespace in other branches
  1. 8 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 133

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);
}