function DefaultPluginManagerTest::testGetDefinitionPluginNotFoundException

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetDefinitionPluginNotFoundException()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetDefinitionPluginNotFoundException()
  3. 11.x 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');
}

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