MigrateImportEventTest.php in Drupal 8
File
core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php
View source
<?php
namespace Drupal\Tests\migrate\Unit\Event;
use Drupal\migrate\Event\MigrateImportEvent;
use Drupal\Tests\UnitTestCase;
class MigrateImportEventTest extends UnitTestCase {
public function testGetMigration() {
$migration = $this
->prophesize('\\Drupal\\migrate\\Plugin\\MigrationInterface')
->reveal();
$message_service = $this
->prophesize('\\Drupal\\migrate\\MigrateMessageInterface')
->reveal();
$event = new MigrateImportEvent($migration, $message_service);
$this
->assertSame($migration, $event
->getMigration());
}
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());
$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');
}
}