public function MigrationTest::testRequirementsForDestinationPlugin in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest::testRequirementsForDestinationPlugin()
Tests checking requirements for destination plugins.
@covers ::checkRequirements
File
- core/
modules/ migrate/ tests/ src/ Unit/ MigrationTest.php, line 54 - Contains \Drupal\Tests\migrate\Unit\MigrationTest.
Class
- MigrationTest
- @coversDefaultClass \Drupal\migrate\Plugin\Migration
Namespace
Drupal\Tests\migrate\UnitCode
public function testRequirementsForDestinationPlugin() {
$migration = new TestMigration();
$source_plugin = $this
->createMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
$destination_plugin = $this
->createMock('Drupal\\Tests\\migrate\\Unit\\RequirementsAwareDestinationInterface');
$destination_plugin
->expects($this
->once())
->method('checkRequirements')
->willThrowException(new RequirementsException('Missing destination requirement', [
'key' => 'value',
]));
$migration
->setSourcePlugin($source_plugin);
$migration
->setDestinationPlugin($destination_plugin);
$this
->expectException(RequirementsException::class);
$this
->expectExceptionMessage('Missing destination requirement');
$migration
->checkRequirements();
}