You are here

public function MigrationTest::testRequirementsForDestinationPlugin in Zircon Profile 8.0

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

Tests checking requirements for destination plugins.

@covers ::checkRequirements

@expectedException \Drupal\migrate\Exception\RequirementsException @expectedExceptionMessage Missing destination requirement

File

core/modules/migrate/tests/src/Unit/MigrationTest.php, line 55
Contains \Drupal\Tests\migrate\Unit\MigrationTest.

Class

MigrationTest
@coversDefaultClass \Drupal\migrate\Entity\Migration @group Migration

Namespace

Drupal\Tests\migrate\Unit

Code

public function testRequirementsForDestinationPlugin() {
  $migration = new TestMigration();
  $source_plugin = $this
    ->getMock('Drupal\\migrate\\Plugin\\MigrateSourceInterface');
  $destination_plugin = $this
    ->getMock('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);
  $migration
    ->checkRequirements();
}