You are here

public function DefaultPluginManagerTest::testGetDefinitionPluginNotFoundException in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetDefinitionPluginNotFoundException()
  2. 9 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetDefinitionPluginNotFoundException()

Tests the plugin manager behavior for a missing plugin ID.

File

core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php, line 138

Class

DefaultPluginManagerTest
Tests the DefaultPluginManager.

Namespace

Drupal\Tests\Core\Plugin

Code

public function testGetDefinitionPluginNotFoundException() {
  $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions);
  $this
    ->expectException(PluginNotFoundException::class);
  $this
    ->expectExceptionMessage('The "missing" plugin does not exist. Valid plugin IDs for Drupal\\Tests\\Core\\Plugin\\TestPluginManager are: apple, banana');
  $plugin_manager
    ->getDefinition('missing');
}