public function DrushTest::testMessages in Migrate Tools 8.5
Same name and namespace in other branches
- 8.4 tests/src/Kernel/DrushTest.php \Drupal\Tests\migrate_tools\Kernel\DrushTest::testMessages()
Tests drush mmsg.
Throws
\Drupal\Component\Plugin\Exception\PluginException
File
- tests/
src/ Kernel/ DrushTest.php, line 161
Class
- DrushTest
- Tests for the Drush 9 commands.
Namespace
Drupal\Tests\migrate_tools\KernelCode
public function testMessages() : void {
$this
->executeMigration('fruit_terms');
$message = $this
->getRandomGenerator()
->string(16);
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->migrationPluginManager
->createInstance('fruit_terms');
$id_map = $migration
->getIdMap();
$id_map
->saveMessage([
'name' => 'Apple',
], $message);
/** @var \Consolidation\OutputFormatters\StructuredData\RowsOfFields $result */
$result = $this->commands
->messages('fruit_terms', [
'csv' => FALSE,
'idlist' => NULL,
'idlist-delimiter' => MigrateTools::DEFAULT_ID_LIST_DELIMITER,
]);
$rows = $result
->getArrayCopy();
$this
->assertSame($message, $rows[0]['message']);
}