You are here

public function MigrateImportEventTest::testLogMessage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php \Drupal\Tests\migrate\Unit\Event\MigrateImportEventTest::testLogMessage()

Tests logging a message.

@covers ::__construct @covers ::logMessage

File

core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php, line 33

Class

MigrateImportEventTest
@coversDefaultClass \Drupal\migrate\Event\MigrateImportEvent @group migrate

Namespace

Drupal\Tests\migrate\Unit\Event

Code

public function testLogMessage() {
  $migration = $this
    ->prophesize('\\Drupal\\migrate\\Plugin\\MigrationInterface');
  $message_service = $this
    ->prophesize('\\Drupal\\migrate\\MigrateMessageInterface');
  $event = new MigrateImportEvent($migration
    ->reveal(), $message_service
    ->reveal());

  // Assert that the intended calls to the services happen.
  $message_service
    ->display('status message', 'status')
    ->shouldBeCalledTimes(1);
  $event
    ->logMessage('status message');
  $message_service
    ->display('warning message', 'warning')
    ->shouldBeCalledTimes(1);
  $event
    ->logMessage('warning message', 'warning');
}