function MigrateStubTest::testExceptionOnPluginNotFound

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateStubTest.php \Drupal\Tests\migrate\Unit\MigrateStubTest::testExceptionOnPluginNotFound()
  2. 8.9.x core/modules/migrate/tests/src/Unit/MigrateStubTest.php \Drupal\Tests\migrate\Unit\MigrateStubTest::testExceptionOnPluginNotFound()
  3. 11.x core/modules/migrate/tests/src/Unit/MigrateStubTest.php \Drupal\Tests\migrate\Unit\MigrateStubTest::testExceptionOnPluginNotFound()

Tests that an error is logged if the plugin manager throws an exception.

File

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

Class

MigrateStubTest
Tests the migrate stub service.

Namespace

Drupal\Tests\migrate\Unit

Code

public function testExceptionOnPluginNotFound() : void {
    $this->migrationPluginManager
        ->createInstances([
        'test_migration',
    ])
        ->willReturn([]);
    $this->expectException(PluginNotFoundException::class);
    $this->expectExceptionMessage("Plugin ID 'test_migration' was not found.");
    $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.