function DefaultPluginManagerTest::testDefaultPluginManagerAnnotationsOnly

Tests the deprecation message for using only annotations.

File

core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php, line 107

Class

DefaultPluginManagerTest
Tests the default plugin manager.

Namespace

Drupal\KernelTests\Core\Plugin

Code

public function testDefaultPluginManagerAnnotationsOnly() : void {
    $subdir = 'Plugin/plugin_test/custom_annotation';
    $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src';
    $namespaces = new \ArrayObject([
        'Drupal\\plugin_test' => $base_directory,
    ]);
    $module_handler = $this->container
        ->get('module_handler');
    $this->expectDeprecation('Not supporting attribute discovery in Drupal\\Core\\Plugin\\DefaultPluginManager is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Provide an Attribute class and an Annotation class for BC. See https://www.drupal.org/node/3395582');
    $manager = new DefaultPluginManager($subdir, $namespaces, $module_handler, NULL, AnnotationPluginExample::class);
    $manager->getDefinitions();
}

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