You are here

public function MigrateStubTest::testExceptionOnDerivedMigration in Drupal 9

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

Tests that an error is logged on derived migrations.

File

core/modules/migrate/tests/src/Unit/MigrateStubTest.php, line 83

Class

MigrateStubTest
Tests the migrate stub service.

Namespace

Drupal\Tests\migrate\Unit

Code

public function testExceptionOnDerivedMigration() {
  $this->migrationPluginManager
    ->createInstances([
    'test_migration',
  ])
    ->willReturn([
    'test_migration:d1' => $this
      ->prophesize(MigrationInterface::class)
      ->reveal(),
    'test_migration:d2' => $this
      ->prophesize(MigrationInterface::class)
      ->reveal(),
  ]);
  $this
    ->expectException(\LogicException::class);
  $this
    ->expectExceptionMessage('Cannot stub derivable migration "test_migration".  You must specify the id of a specific derivative to stub.');
  $stub = new MigrateStub($this->migrationPluginManager
    ->reveal());
  $stub
    ->createStub('test_migration', [
    1,
  ]);
}