Fix Drupal 9.0.0 deprecations and test failures

Created on 2 January 2022, over 2 years ago
Updated 21 June 2023, about 1 year ago

Problem/Motivation

In Drupal 9.0:

  • Declaring ::setUp without a void return typehint in Drupal\Tests\config_actions\Kernel\ConfigActionsPluginTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724 β†’
  • The Drupal\Tests\config_actions\Kernel\ConfigActionsPluginTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426 β†’
  • TypeError : Argument 2 passed to PHPUnit\Framework\Assert::assertNotNull() must be of the type string, array given, called in config_actions/tests/src/Kernel/ConfigActionsServiceTest.php on line 65

Also, test should not redeclare "protected setUp()" as public.

Steps to reproduce

Run unit and kernel tests in a d9 context and observe deprecation notices.

Proposed resolution

Make $modules and setUp() protected, add void type hint, and fix incorrect argument type in assertion.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kdebisschop

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024