You are here

public function DefaultPluginManagerTest::testDefaultPluginManagerWithPluginExtendingNonInstalledClass in Drupal 8

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

Tests the plugin manager with a plugin that extends a non-installed class.

File

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

Class

DefaultPluginManagerTest
Tests the DefaultPluginManager.

Namespace

Drupal\Tests\Core\Plugin

Code

public function testDefaultPluginManagerWithPluginExtendingNonInstalledClass() {
  $definitions = [];
  $definitions['extending_non_installed_class'] = [
    'id' => 'extending_non_installed_class',
    'label' => 'A plugin whose class is extending from a non-installed module class',
    'color' => 'pink',
    'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\ExtendingNonInstalledClass',
    'provider' => 'plugin_test',
  ];
  $module_handler = $this
    ->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
  $plugin_manager = new TestPluginManager($this->namespaces, $definitions, $module_handler, 'test_alter_hook', '\\Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\FruitInterface');
  $plugin_manager
    ->getDefinition('plugin_test', FALSE);
  $this
    ->assertTrue(TRUE, 'No PHP fatal error occurred when retrieving the definitions of a module with plugins that depend on a non-installed module class should not cause a PHP fatal.');
}