class EventBaseTest
Same name and namespace in other branches
- 11.x core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php \Drupal\Tests\migrate\Unit\Event\EventBaseTest
- 10 core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php \Drupal\Tests\migrate\Unit\Event\EventBaseTest
- 8.9.x core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php \Drupal\Tests\migrate\Unit\Event\EventBaseTest
@coversDefaultClass \Drupal\migrate\Event\EventBase
@group migrate
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Unit\Event\EventBaseTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of EventBaseTest
File
-
core/
modules/ migrate/ tests/ src/ Unit/ Event/ EventBaseTest.php, line 12
Namespace
Drupal\Tests\migrate\Unit\EventView source
class EventBaseTest extends UnitTestCase {
/**
* Tests getMigration method.
*
* @covers ::__construct
* @covers ::getMigration
*/
public function testGetMigration() {
$migration = $this->prophesize('\\Drupal\\migrate\\Plugin\\MigrationInterface')
->reveal();
$message_service = $this->prophesize('\\Drupal\\migrate\\MigrateMessageInterface')
->reveal();
$row = $this->prophesize('\\Drupal\\migrate\\Row')
->reveal();
$event = new EventBase($migration, $message_service, $row, [
1,
2,
3,
]);
$this->assertSame($migration, $event->getMigration());
}
/**
* Tests logging a message.
*
* @covers ::__construct
* @covers ::logMessage
*/
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');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.