You are here

public function MigrateMessageTest::testMessagesTeed in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::testMessagesTeed()
  2. 9 core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::testMessagesTeed()

Tests migration interruptions.

File

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

Class

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

Namespace

Drupal\Tests\migrate\Kernel

Code

public function testMessagesTeed() {

  // Ask to receive any messages sent to the idmap.
  \Drupal::service('event_dispatcher')
    ->addListener(MigrateEvents::IDMAP_MESSAGE, [
    $this,
    'mapMessageRecorder',
  ]);
  $executable = new MigrateExecutable($this->migration, $this);
  $executable
    ->import();
  $this
    ->assertCount(1, $this->messages);
  $id = $this->migration
    ->getPluginId();
  $this
    ->assertSame("source_message: {$id}:message:concat: 'a message' is not an array", reset($this->messages));
}