You are here

public function MigrateMessageTest::mapMessageRecorder in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Tests/MigrateMessageTest.php \Drupal\migrate\Tests\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/src/Tests/MigrateMessageTest.php, line 114
Contains \Drupal\migrate\Tests\MigrateMessageTest.

Class

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

Namespace

Drupal\migrate\Tests

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