You are here

public function EventBaseTest::testLogMessage in Drupal 8

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

Test logging a message.

@covers ::__construct @covers ::logMessage

File

core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php, line 34

Class

EventBaseTest
@coversDefaultClass \Drupal\migrate\Event\EventBase @group migrate

Namespace

Drupal\Tests\migrate\Unit\Event

Code

public function testLogMessage() {
  $migration = $this
    ->prophesize('\\Drupal\\migrate\\Plugin\\MigrationInterface')
    ->reveal();
  $message_service = $this
    ->prophesize('\\Drupal\\migrate\\MigrateMessageInterface');
  $event = new EventBase($migration, $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');
}