function MigrateStubTest::testExceptionOnDerivedMigration

Same name in other branches
  1. 9 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()
  3. 11.x 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 82

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,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.