From 569ab66ef137c9587bf654ea8a62c1d95d7035a7 Mon Sep 17 00:00:00 2001 From: Michael Strelan <mstrelan@gmail.com> Date: Tue, 25 Mar 2025 10:27:38 +1000 Subject: [PATCH 1/2] Wait terminate perhaps --- .../tests/src/Functional/Theme/ToolbarClaroOverridesTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/modules/system/tests/src/Functional/Theme/ToolbarClaroOverridesTest.php b/core/modules/system/tests/src/Functional/Theme/ToolbarClaroOverridesTest.php index ec113eeab86a..ae0f9c9cd947 100644 --- a/core/modules/system/tests/src/Functional/Theme/ToolbarClaroOverridesTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ToolbarClaroOverridesTest.php @@ -6,6 +6,7 @@ use Drupal\Core\Theme\ThemeManagerInterface; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\WaitTerminateTestTrait; /** * Tests the loading of Claro assets on a non-Claro default theme. @@ -14,6 +15,8 @@ */ class ToolbarClaroOverridesTest extends BrowserTestBase { + use WaitTerminateTestTrait; + /** * {@inheritdoc} */ @@ -56,6 +59,8 @@ protected function setUp(): void { 'administer shortcuts', 'access content overview', ])); + + $this->setWaitForTerminate(); } /** -- GitLab From bb9e72a1558d50b7267fc6e3f875087ef5a47d92 Mon Sep 17 00:00:00 2001 From: Michael Strelan <mstrelan@gmail.com> Date: Tue, 25 Mar 2025 10:35:24 +1000 Subject: [PATCH 2/2] phpstan --- core/.phpstan-baseline.php | 42 ------------------- .../Drupal/Tests/WaitTerminateTestTrait.php | 2 +- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 95ec5db24667..c99db935f3a6 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -21111,12 +21111,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/jsonapi/tests/src/Functional/NodeTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\jsonapi\\\\Functional\\\\NodeTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/jsonapi/tests/src/Functional/NodeTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\jsonapi\\\\Functional\\\\ResourceTestBase\\:\\:addEntityTypeAndBundleToWorkflow\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -21987,12 +21981,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/language/tests/language_test/src/Controller/LanguageTestController.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\language\\\\Functional\\\\ConfigurableLanguageManagerTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/language/tests/src/Functional/ConfigurableLanguageManagerTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\language\\\\Functional\\\\LanguageBreadcrumbTest\\:\\:assertBreadcrumb\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -24261,12 +24249,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\locale\\\\Functional\\\\LocaleLocaleLookupTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\locale\\\\Functional\\\\LocalePathTest\\:\\:assertPathAliasExists\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -29475,12 +29457,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/path/src/Plugin/Validation/Constraint/PathAliasConstraintValidator.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\path\\\\Functional\\\\PathAliasTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/path/tests/src/Functional/PathAliasTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\path\\\\Functional\\\\PathContentModerationTest\\:\\:addEntityTypeAndBundleToWorkflow\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -36577,12 +36553,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/src/Functional/System/CronRunTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\system\\\\Functional\\\\System\\\\CronRunTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/src/Functional/System/CronRunTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\system\\\\Functional\\\\System\\\\DateTimeTest\\:\\:assertFieldDoesNotExist\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -47449,12 +47419,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/tests/src/Functional/Plugin/DisplayFeedTranslationTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\views\\\\Functional\\\\Plugin\\\\DisplayFeedTranslationTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/src/Functional/Plugin/DisplayFeedTranslationTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\views\\\\Functional\\\\Plugin\\\\DisplayPageWebTest\\:\\:assertCacheContext\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', @@ -49885,12 +49849,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method Drupal\\\\Tests\\\\workspaces\\\\Functional\\\\PathWorkspacesTest\\:\\:setWaitForTerminate\\(\\) has no return type specified\\.$#', - 'identifier' => 'missingType.return', - 'count' => 1, - 'path' => __DIR__ . '/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method Drupal\\\\Tests\\\\workspaces\\\\Functional\\\\PathWorkspacesTest\\:\\:setupWorkspaceSwitcherBlock\\(\\) has no return type specified\\.$#', 'identifier' => 'missingType.return', diff --git a/core/tests/Drupal/Tests/WaitTerminateTestTrait.php b/core/tests/Drupal/Tests/WaitTerminateTestTrait.php index 2423af83f9dd..ad629abbae4e 100644 --- a/core/tests/Drupal/Tests/WaitTerminateTestTrait.php +++ b/core/tests/Drupal/Tests/WaitTerminateTestTrait.php @@ -16,7 +16,7 @@ trait WaitTerminateTestTrait { * Tests with assertions which operate on data computed during the terminate * event need to enable this. */ - protected function setWaitForTerminate() { + protected function setWaitForTerminate(): void { $this->container->get('state')->set('drupal.test_wait_terminate', TRUE); } -- GitLab