function MigrateMessageTest::testGetMessages
Same name in other branches
- 8.9.x core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::testGetMessages()
- 10 core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::testGetMessages()
- 11.x core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php \Drupal\Tests\migrate\Kernel\MigrateMessageTest::testGetMessages()
Tests the return value of getMessages().
This method returns an iterator of StdClass objects. Check that these objects have the expected keys.
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ MigrateMessageTest.php, line 107
Class
- MigrateMessageTest
- Tests whether idmap messages are sent to message interface when requested.
Namespace
Drupal\Tests\migrate\KernelCode
public function testGetMessages() {
$id = $this->migration
->getPluginId();
$expected_message = (object) [
'src_name' => 'source_message',
'dest_config_name' => NULL,
'msgid' => '1',
Sql::SOURCE_IDS_HASH => '170cde81762e22552d1b1578cf3804c89afefe9efbc7cc835185d7141060b032',
'level' => '1',
'message' => "{$id}:message:concat: 'a message' is not an array",
];
$executable = new MigrateExecutable($this->migration, $this);
$executable->import();
$count = 0;
foreach ($this->migration
->getIdMap()
->getMessages() as $message) {
++$count;
$this->assertEquals($expected_message, $message);
}
$this->assertEquals(1, $count);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.