From 0376fa17ef76ca2df75663ba2b6e5427cc432992 Mon Sep 17 00:00:00 2001 From: quietone <quietone@2572884.no-reply.drupal.org> Date: Sun, 29 Dec 2024 18:04:05 +1300 Subject: [PATCH] Issue #3495638 by nikolay shapovalov, smustgrave, nicxvan: Move helpers in workflow_type_test.module and delete it --- core/.phpstan-baseline.php | 6 ------ .../workflow_type_test.module | 19 ------------------- .../WorkflowAccessControlHandlerTest.php | 3 ++- 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index cdc32086a3da..de4ec2e64602 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -53223,12 +53223,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/WorkflowCustomAccessType.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Function workflow_type_test_set_definitions\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\workflows\\\\Functional\\\\Rest\\\\WorkflowJsonAnonTest\\:\\:assertAuthenticationEdgeCases\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', diff --git a/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module b/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module deleted file mode 100644 index f74b802cdfb0..000000000000 --- a/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -/** - * @file - * Module file for workflow_type_test. - */ - -declare(strict_types=1); - -/** - * Sets the type plugin definitions override and clear the cache. - * - * @param array $definitions - * Definitions to set. - */ -function workflow_type_test_set_definitions($definitions) { - \Drupal::state()->set('workflow_type_test.plugin_definitions', $definitions); - \Drupal::service('plugin.manager.workflows.type')->clearCachedDefinitions(); -} diff --git a/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php b/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php index b3e3d9a9c208..f24e427b2ef3 100644 --- a/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php +++ b/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php @@ -88,7 +88,8 @@ public function testCheckCreateAccess(): void { // Remove all plugin types and ensure not even the admin user is allowed to // create a workflow. - workflow_type_test_set_definitions([]); + $this->container->get('state')->set('workflow_type_test.plugin_definitions', []); + $this->container->get('plugin.manager.workflows.type')->clearCachedDefinitions(); $this->accessControlHandler->resetCache(); $this->assertEquals( AccessResult::neutral() -- GitLab