summaryrefslogtreecommitdiffstatshomepage
path: root/core/tests/Drupal/KernelTests
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/Drupal/KernelTests')
-rw-r--r--core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php16
-rw-r--r--core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php17
2 files changed, 17 insertions, 16 deletions
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
index 3d5a6c8508ba..8ee28a968fd5 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php
@@ -36,20 +36,4 @@ class ModuleHandlerTest extends KernelTestBase {
$this->assertNotNull(\Drupal::service('module_handler')->getName('module_test'));
}
- /**
- * Tests that resetImplementations clears the invokeMap memory cache.
- *
- * @covers ::resetImplementations
- */
- public function testResetImplementationsClearsInvokeMap(): void {
- /** @var \Drupal\Core\Extension\ModuleInstallerInterface $moduleInstaller */
- $moduleInstaller = \Drupal::service('module_installer');
- $moduleInstaller->install(['module_test']);
- /** @var \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler */
- $moduleHandler = \Drupal::service('module_handler');
- $this->assertTrue($moduleHandler->hasImplementations('system_info_alter'));
- $moduleInstaller->uninstall(['module_test']);
- $this->assertFalse($moduleHandler->hasImplementations('system_info_alter'));
- }
-
}
diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php
index 21370884e107..caf97cb6c0de 100644
--- a/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/DefaultPluginManagerTest.php
@@ -14,6 +14,7 @@ use org\bovigo\vfs\vfsStream;
* Tests the default plugin manager.
*
* @group Plugin
+ * @group legacy
*/
class DefaultPluginManagerTest extends KernelTestBase {
@@ -44,6 +45,7 @@ class DefaultPluginManagerTest extends KernelTestBase {
// Ensure there is a class with the expected name. We cannot reflect on this
// as it triggers a fatal error.
$this->assertFileExists($base_directory . '/' . $subdir . '/UsingNonInstalledTraitClass.php');
+ $this->expectDeprecation('Using @PluginExample annotation for plugin with ID example_1 is deprecated and is removed from drupal:13.0.0. Use a Drupal\plugin_test\Plugin\Attribute\PluginExample attribute instead. See https://www.drupal.org/node/3395575');
// Annotation only.
$manager = new DefaultPluginManager($subdir, $namespaces, $module_handler, NULL, AnnotationPluginExample::class);
@@ -99,4 +101,19 @@ class DefaultPluginManagerTest extends KernelTestBase {
$this->assertArrayNotHasKey('example_annotation_not_attribute', $definitions);
}
+ /**
+ * Tests the deprecation message for using only annotations.
+ */
+ 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();
+ }
+
}