Problem/Motivation

Spin-off from #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7.

PHPUnit 8 is changing the signature of the main test methods that test classes extend - above all setUp and tearDown, adding a void return typehint.

As per #3063887-75: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7, in this issue we change the signatures of the methods in concrete Drupal test code according to PHPUnit 8.

Proposed resolution

@catch and I agreed that this is a good approach for addressing this compatibility issue so that we're ready by Drupal 10. Thanks!
Change all the implementations of

  • setUp()
  • tearDown()
  • setUpBeforeClass()
  • assertPostConditions()

in concrete test classes to have a void return typehint.

We will then add a deprecation to inform developers of this change in #3111044: Deprecate setUp/tearDown concrete test methods that do not specify void return type

We cannot change abstract base test classes without breaking backward compatibility, so that will be done in a follow-up.

Remaining tasks

Patch.

User interface changes

API changes

Data model changes

Release notes snippet

Overridden test methods should have void return type hints added, see the change record at https://www.drupal.org/node/3114724 for more details.

CommentFileSizeAuthor
#104 3107732-104-D90x.patch1.12 MBmondrake
#104 3107732-104-D91x.patch1.12 MBmondrake
#103 3107732-103-D90x.patch1.12 MBmondrake
#103 3107732-103-D91x.patch1.12 MBmondrake
#100 interdiff_99-100.txt615 bytesmondrake
#100 3107732-100.patch1.12 MBmondrake
#99 3107732-99.patch1.12 MBmondrake
#99 interdiff_98-99.txt625 bytesmondrake
#98 3107732-98.patch1.12 MBmondrake
#97 3107732-97.patch1.11 MBmondrake
#83 interdiff_78-83.txt502 bytesswatichouhan012
#83 3107732-83.patch1.12 MBswatichouhan012
#78 interdiff_75-78.txt3 KBswatichouhan012
#78 3107732-78.patch1.12 MBswatichouhan012
#77 3107732-75-with-deprecation-trigger.patch1.12 MBswatichouhan012
#77 3107732-77.patch1.12 MBswatichouhan012
#75 3107732-75-with-deprecation-trigger.patch1.12 MBmondrake
#74 interdiff_71-74.txt568 bytesmondrake
#74 3107732-74-with-deprecation-trigger.patch1.12 MBmondrake
#71 3107732-71-with-deprecation-trigger.patch1.12 MBmondrake
#68 interdiff_66-67.txt554 bytesmondrake
#68 3107732-67-with-deprecation-trigger.patch1.12 MBmondrake
#66 interdiff_65-66.txt1.69 KBmondrake
#66 3107732-66-with-deprecation-trigger.patch1.12 MBmondrake
#65 interdiff.txt8.55 KBmondrake
#65 3107732-65.patch1.12 MBmondrake
#63 interdiff_61-63.txt483.82 KBswatichouhan012
#63 3107732-63.patch1.12 MBswatichouhan012
#61 3107732-61.patch1.12 MBlongwave
#60 interdiff_57-60.txt1.67 KBswatichouhan012
#60 3107732-60.patch1.12 MBswatichouhan012
#57 interdiff.3107732.54-57.txt6.54 KBlongwave
#57 3107732-57.patch1.11 MBlongwave
#54 merge-conflicts-info.txt758 bytessalah1
#54 3107732-54.patch1.1 MBsalah1
#50 interdiff.3107732.46-50.txt712 byteslongwave
#50 3107732-50.patch1.11 MBlongwave
#46 3107732-46.patch1.1 MBmondrake
#46 interdiff_43-46.txt1.15 KBmondrake
#43 interdiff_41-43.txt662 bytesmondrake
#43 3107732-43.patch1.11 MBmondrake
#41 3107732-41.patch1.11 MBmondrake
#37 3107732-36-test-only.patch1.7 KBmondrake
#36 3107732-35.patch1.11 MBmondrake
#36 interdiff_28-36.txt2.26 KBmondrake
#28 interdiff.3107732.26-28.txt535 byteslongwave
#28 3107732-28.patch1.11 MBlongwave
#26 interdiff.3107732.24-26.txt507 byteslongwave
#26 3107732-26.patch1.11 MBlongwave
#24 interdiff_16-24.txt62.24 KBmondrake
#24 3107732-24.patch1.12 MBmondrake
#16 3107732-16.patch1.18 MBmondrake
#15 3107732-15.patch1.18 MBmondrake
#14 3107732-14.patch1.18 MBmondrake
#13 3107732-13.patch1.18 MBmondrake
#9 interdiff.3107732.5-9.txt1.69 KBlongwave
#9 3107732-9.patch1.19 MBlongwave
#6 interdiff.3107732.3-5.txt3.41 KBlongwave
#6 3107732-5.patch1.19 MBlongwave
#3 3107732-3.patch1.18 MBlongwave
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mondrake created an issue. See original summary.

mondrake’s picture

longwave’s picture

Status: Active » Needs review
FileSize
1.18 MB

Attached patch created with this script, which adds the return type for everything that isn't related to legacy SimpleTests, plus one or two manual fixes on top.

find core -name '*.php' | grep -v simpletest/src | xargs -n1 grep -EL 'use.*simpletest' | xargs sed -E -i "s/(function (setUp|tearDown|setUpBeforeClass|assertPostConditions)\(.*\)) /\1: void /"

Status: Needs review » Needs work

The last submitted patch, 3: 3107732-3.patch, failed testing. View results

mondrake’s picture

Tagging. Looks promising, only 5 failures.

longwave’s picture

Status: Needs work » Needs review
FileSize
1.19 MB
3.41 KB

Missed one class that mentions simpletest and four that use "setup()" instead of "setUp()". Some method visibilities are also wrong but I think that is out of scope to fix here.

longwave’s picture

If this isn't viable because of the BC break with contrib/custom tests then I think this is still worth doing on the subclasses. We could emit a deprecation warning by using ReflectionMethod::hasReturnType() to tell contrib/custom code that they need to add the return type.

mondrake’s picture

#6:

core/modules/comment/src/Tests/Views/CommentTestBase.php
core/modules/system/src/Tests/Entity/EntityCacheTagsTestBase.php
core/modules/views/src/Tests/Wizard/WizardTestBase.php

are Simpletest WebTestBase tests, should not be impacted by this change

longwave’s picture

Thanks, fixed those. The ones further down the class hierarchy are always going to end up false positives when using basic tools like find/grep/sed.

mondrake’s picture

#7: that's going to be a choice between a hard failure and a deprecation failure (as long as custom/contrib enabled deprecation failure in their drupalci.yml). IMHO, as a contrib developer, better fail hard in this case rather than implementing and maintaining a BC layer. Per se, the changes required to test cases are trivial once it's clear what needs to be done. My 2 cents.

mondrake’s picture

For an example of a contrib module meant to support D8.8 as well as D9, and adding void return typehints to the test cases under the current core test codebase without the typehint yet, see #3106802: Add void return typehint to test setUp methods. Results are as expected - pass on D8.8, D8.9 and D9.0 with PHP 7.1+, fail for PHP 7.0.

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Based on #10, I cannot see anything else to be done here... apart from deciding that we want to do this.

mondrake’s picture

mondrake’s picture

Reroll - there'll be a few while BC layers get removed.

mondrake’s picture

FileSize
1.18 MB

Reroll

mondrake’s picture

FileSize
1.18 MB

Reroll

xjm’s picture

Status: Reviewed & tested by the community » Needs work

This needs a CR and a release note. Thanks!

alexpott’s picture

I agree that this is a big issue to solve with PHPUnit 8.

The downside of this solution is that if you have a module where you want to support 8.8 and 9.0 with the same codebase you minimum PHP is then 7.1. I think this is pretty unavoidable. The only other solution is to move to Symfony's simple-phpunit and that was not at all simple and will be even more disruptive given we'd have to drop PHPUnit as dev dependency of core. Also PHP 7.0 is not longer supported so I think the trade-off here is okay given what we have to work with.

So I'm +1 to the idea but the issue summary needs a major update to spell out the impacts of this change on the ecosystem.

Leaving "needs framework manager review" on the issue for other framework managers to have their say.

mondrake’s picture

Version: 9.0.x-dev » 9.1.x-dev
Priority: Critical » Normal
Status: Needs work » Postponed

Postponing due to latest developments in #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7 that are making this less urgent.

catch’s picture

Version: 9.1.x-dev » 9.0.x-dev
Priority: Normal » Major
Status: Postponed » Needs work

I think we should still be doing this in 9.0.x so that we're not relying on our own bc layer. We could potentially delay any base test classes to 9.1.x though but the regular tests should be brought up to date.

Berdir’s picture

Even when excluding the base classes that might be tricky and will break at least a few modules. redis for example re-uses a few tests from core (lock and queue) and with complex hierarchies like the rest/jsonapi test structure, what exactly is a base class, what do we change and what not?

Berdir’s picture

I'm not saying that's a definitive blocker, redis for example has been broken a few times with those tricks as we don't really support that anyway, although also in good ways (extended coverage in core showing of bugs in the redis implementation). Just something to consider when doing it. and unless we add it to our base classes, we 100% rely on our BC layer to anyway, the final breaking patch would just be smaller.

catch’s picture

I think something like redis should expect to update its test coverage every so often (although that's a reason not to mark tests final, since I think it's a valid use-case to piggyback off core tests like that and people know what they're doing when they do it).

and unless we add it to our base classes, we 100% rely on our BC layer to anyway

This is true but it'd be a lot less bad examples in core for people to potentially copy/paste from.

mondrake’s picture

Status: Needs work » Needs review
FileSize
1.12 MB
62.24 KB

Rerolled, and with return typehints removed from base classes as per #3063887-75: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7.

Status: Needs review » Needs work

The last submitted patch, 24: 3107732-24.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

longwave’s picture

Status: Needs work » Needs review
FileSize
1.11 MB
507 bytes

Status: Needs review » Needs work

The last submitted patch, 26: 3107732-26.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

longwave’s picture

Status: Needs work » Needs review
FileSize
1.11 MB
535 bytes

The last submitted patch, 26: 3107732-26.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mondrake’s picture

Issue summary: View changes

Updated IS.

mondrake’s picture

mondrake’s picture

mondrake’s picture

Title: Add return typehints to setUp/tearDown test methods » Add return typehints to setUp/tearDown in concrete test methods
mondrake’s picture

Title: Add return typehints to setUp/tearDown in concrete test methods » Add return typehints to setUp/tearDown methods in concrete test classes
mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work
mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review
FileSize
2.26 KB
1.11 MB

Here's the PoC. We use reflection at the time of a startTest to detect whether a method is declared in the class or inherited, and if declared inline without a void return typehint, throw a deprecation message.

For convenience, I reverted the change in a single method from #28 to ensure we have at least a failure (and if we have only 1, #28 would be great work... :))

mondrake’s picture

A deprecation test-only patch to see bigger picture.

The last submitted patch, 36: 3107732-35.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 37: 3107732-36-test-only.patch, failed testing. View results

mondrake’s picture

Status: Needs work » Needs review

So:

#36 demonstrates that #28 is indeed great 😀

#37 demonstrates that the deprecation PoC works

mondrake’s picture

Status: Needs review » Needs work

The last submitted patch, 41: 3107732-41.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

mondrake’s picture

Status: Needs work » Needs review
FileSize
1.11 MB
662 bytes

The deprecation thingie works nicely, #41 captured a newly added test class and signalled that the void typehint is missing.

mondrake’s picture

longwave’s picture

Nice work on the deprecation test :)

I think as per @alexpott in #3063887-75: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7 we need to only add the typehints here in 9.0.x. Do you want to spin off the deprecation into a new issue for 9.1.x?

+++ b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
@@ -18,11 +18,41 @@ class DrupalListener implements TestListener {
+          if (!$reflected_method->getReturnType() || $reflected_method->getReturnType()->getName() !== 'void') {

Real tiny nitpick but you can say ->hasReturnType() in the first half of the if statement here.

mondrake’s picture

#45 thanks @longwave.

1. See #3111044: Deprecate setUp/tearDown concrete test methods that do not specify void return type. The idea is to keep the deprecation PoC here until before commit, then remove and move it there for 9.1.

2. Done, thanks!

Rerolling after removal of simpletest module. This will fail with deprecations for any newly added test class.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Nothing more to do here as far as I can see, marking RTBC to get core committers attention on this proof of concept and help figure out next steps to get this committed.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 46: 3107732-46.patch, failed testing. View results

voleger’s picture

New tests introduced, they have to be updated appropriately.

longwave’s picture

longwave’s picture

Added draft change record: https://www.drupal.org/node/3114724

Updated issue summary and added a draft line for the release notes, but perhaps it could be worded better.

mondrake’s picture

Status: Needs review » Needs work
Issue tags: -PHPUnit 8 +PHP, +Needs reroll
mondrake’s picture

Issue tags: -PHP +PHPUnit8
salah1’s picture

Status: Needs work » Needs review
FileSize
1.1 MB
758 bytes

I rerolled the patch on #50.
It didn't apply so i worked on the conflicts shown by git. After that, the [git rebase --continue] was successfull, but the following step failed.
[Testing my patch by applying it to the upstream branch]. See the attached txt for more info.

Status: Needs review » Needs work

The last submitted patch, 54: 3107732-54.patch, failed testing. View results

xjm’s picture

Priority: Major » Critical
longwave’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.11 MB
6.54 KB

Thanks @salah1!

Fixed up the patch to include new test methods and a merge error. Also updated the deprecation message to link to the CR.

Status: Needs review » Needs work

The last submitted patch, 57: 3107732-57.patch, failed testing. View results

swatichouhan012’s picture

Assigned: Unassigned » swatichouhan012

I am working on this

swatichouhan012’s picture

Assigned: swatichouhan012 » Unassigned
Status: Needs work » Needs review
FileSize
1.12 MB
1.67 KB

Fixed some test fail in comment #57. Kindly review new patch.

longwave’s picture

Reroll of #60 due to conflict in core/modules/file/tests/src/Kernel/Migrate/d7/MigratePrivateFileTest.php

Status: Needs review » Needs work

The last submitted patch, 61: 3107732-61.patch, failed testing. View results

swatichouhan012’s picture

FileSize
1.12 MB
483.82 KB

Removed deleted patch code from file and updated with some test fix,

longwave’s picture

As this affects almost every test class and has needed repeated rerolls I wonder if this is going to need a fixed window to try and get this in, similar to #2822382: Make every $modules property protected on classes extending BrowserTestBase and KernelTestBase - it seems futile rerolling it when almost every core commit breaks it again.

mondrake’s picture

Status: Needs work » Needs review
FileSize
1.12 MB
8.55 KB

FWiW, totally agree on #64...

mondrake’s picture

#65 + the deprecation PoC.

catch’s picture

I am +1 on scheduling this, but I am not sure when for yet - agreed it's the sort of patch where a specific commit window would be beneficial.

@xjm was not sure about committing this to 9.x at all, I think it's worth it:

the current bc layer we added rewrites test classes, but this is forward compatible with tests that implement the return type hints.

Doing this patch is equivalent to removing deprecated usages for a 'normal' deprecation - then in 10.x we would only need to add the type hints for the base classes (a test API change for everything extending those classes) and remove the bc layer (same but for every conveivable test).

Applying this patch earlier makes it more likely that contrib modules will follow core's example and add the return type hints themselves, something they would ideally do before we remove the bc layer in 10.x.

mondrake’s picture

The last submitted patch, 65: 3107732-65.patch, failed testing. View results

The last submitted patch, 66: 3107732-66-with-deprecation-trigger.patch, failed testing. View results

mondrake’s picture

mondrake’s picture

Status: Needs review » Needs work

The last submitted patch, 71: 3107732-71-with-deprecation-trigger.patch, failed testing. View results

mondrake’s picture

Status: Needs work » Needs review
FileSize
1.12 MB
568 bytes
mondrake’s picture

Status: Needs review » Needs work

The last submitted patch, 75: 3107732-75-with-deprecation-trigger.patch, failed testing. View results

swatichouhan012’s picture

Updated test class setup().

swatichouhan012’s picture

Remove wrong file, kindly review new patch with interdiff

The last submitted patch, 77: 3107732-75-with-deprecation-trigger.patch, failed testing. View results

The last submitted patch, 77: 3107732-77.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 78: 3107732-78.patch, failed testing. View results

neelam_wadhwani’s picture

Assigned: Unassigned » neelam_wadhwani
swatichouhan012’s picture

Assigned: neelam_wadhwani » Unassigned
Status: Needs work » Needs review
FileSize
1.12 MB
502 bytes

updated patch #78 for class NodeClassicTest

mondrake’s picture

Can we try to get this in before beta? It's green now, rerolls are complicated, I'm afraid after beta this will be a no go

mondrake’s picture

Status: Needs review » Postponed

Postponed, #64 pointed out well this needs purposeless rerolls practically every day. Let's build on #67 to have a potential window when to make the effort meaningful.

xjm’s picture

Issue tags: +beta target, +rc deadline

@catch and I discussed doing this as a scheduled beta target late in the beta process. It should happen before RC (which begins the first week of May) because it could theoretically be disruptive for contrib that extends an individual core test (which some contrib does do). Since individual tests are internal, it's OK to make the change during beta, but we should not do it during RC to avoid disruption.

I'd suggest picking a target few days in late April to roll, review, and commit the change?

mondrake’s picture

@xjm can you update the issue title with a date range, so that those watching can act in that timeframe?

xjm’s picture

@mondranke It's up to the participants to pick the date range because they're the ones committing to do the patch during that timeframe.

  • I'd suggest a couple days in the third week of April maybe? (To avoid colliding with any high-priority issues that might be crammed to land before the commit deadline for RC1.)
  • A weekday is best for highest committer availability.

We'll want to get the signoffs from the change before that. Waiting to discuss with @catch a little further to confirm RM signoff, and I'll also link it in committer Slack asking for FM signoff.

alexpott’s picture

As a framework manager I sign off on the approach of

xjm’s picture

Issue summary: View changes
Issue tags: -Needs release manager review

@catch and I agreed that this is a good approach for addressing this compatibility issue so that we're ready by Drupal 10, so long as we're also sure to do #3111044: Deprecate setUp/tearDown concrete test methods that do not specify void return type after 9.1.x is opened for development next week. Thanks!

mondrake’s picture

Version: 9.0.x-dev » 9.1.x-dev

#89, #90 - in this case I suggest to use this issue to get a patch in 9.1.x first with the deprecation thingie in (it will be open for development before the time window to get it into 9.0.x), and then port to 9.0.x without the thingie. That would make the other issue redundant, and also we could have here two patches, one with the thingie (for 9.1.x) and one without (for 9.0.x), for quicker commit.

catch’s picture

Version: 9.1.x-dev » 9.0.x-dev

@mondrake that makes sense, although we should still keep this issue against the lowest applicable version.

xjm’s picture

I may be out of the loop but what "thingie"?

catch’s picture

@xjm #3111044: Deprecate setUp/tearDown concrete test methods that do not specify void return type is proposing to add some way to trigger a deprecation notice when a test class doesn't have return type hints - as a new deprecation this could land in 9.1.x-only - this is the 'thingie'. The proposal is to merge that issue back into this one, but with separate 9.1.x and 9.0.x patches (the 9.0.x patch just would not have the hunk adding the deprecation detection/triggering logic).

mondrake’s picture

😀

This is the 'thingie':

+++ b/core/tests/Drupal/Tests/Listeners/DrupalListener.php
@@ -18,11 +18,41 @@ class DrupalListener implements TestListener {
   use DrupalComponentTestListenerTrait;
   use DrupalStandardsListenerTrait;
 
+  /**
+   * A list of methods to be checked for void return typehint.
+   *
+   * @var string[]
+   */
+  protected $methodsWithVoidReturn = [
+    'setUpBeforeClass',
+    'setUp',
+    'assertPreConditions',
+    'assertPostConditions',
+    'tearDown',
+    'tearDownAfterClass',
+    'onNotSuccessfulTest',
+  ];
+
   /**
    * {@inheritdoc}
    */
   public function startTest(Test $test): void {
     $this->deprecationStartTest($test);
+
+    // Check for missing void return typehints in concrete test classes'
+    // methods. If the method is inherited from a base test class, do
+    // nothing.
+    $class = new \ReflectionClass($test);
+    foreach ($this->methodsWithVoidReturn as $method) {
+      if ($class->hasMethod($method)) {
+        $reflected_method = $class->getMethod($method);
+        if ($reflected_method->getDeclaringClass()->getName() === get_class($test)) {
+          if (!$reflected_method->hasReturnType() || $reflected_method->getReturnType()->getName() !== 'void') {
+            @trigger_error("Declaring ::$method without a void return typehint in " . get_class($test) . " is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724", E_USER_DEPRECATED);
+          }
+        }
+      }
+    }
   }
 
   /**
mondrake’s picture

Title: Add return typehints to setUp/tearDown methods in concrete test classes » Between April 13 and April 17, 2020: Add return typehints to setUp/tearDown methods in concrete test classes
mondrake’s picture

Bot, what's the outlook today?

mondrake’s picture

mondrake’s picture

mondrake’s picture

FileSize
1.12 MB
615 bytes
longwave’s picture

Status: Postponed » Reviewed & tested by the community

As this is currently green let's mark it RTBC and get it tested nightly to automatically catch any new tests in the next few days that will need fixing here.

mondrake’s picture

Version: 9.0.x-dev » 9.1.x-dev

Switching to 9.1.x to allow filing two patches.

mondrake’s picture

Two patches, one (D91x) for D9.1 with the deprecation code, one (D90x) for D9.0 with the return typehints only.

mondrake’s picture

jungle’s picture

I would suggest adding a sniffer/phpcs rule for this. But to do it in a separate issue as it depends on a new patch and a new release of the coder module. It's good to have the patch(es) here committed first, then the next patch would be much smaller and easy to review, or the current window will be missed probably.

alexpott’s picture

@jungle there does not need to be a PHPCS rule for this. We’re triggering a deprecated error and once we remove the BC layer tests will just break with a language level error.

jungle’s picture

@alexpott, you are RIGHT! Thanks for your reply!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 0dc2853 and pushed to 9.1.x. Thanks!

Had to edit the diffs to fix core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIPsTest.php to core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php caused by #3126784: \Drupal\ban\Plugin\migrate\destination\BlockedIP is not identical with its filename BlockedIp.php. Definitely worth getting this done now to prevent re-re-re-re...rolling.

  • alexpott committed 0dc2853 on 9.1.x
    Issue #3107732 by mondrake, longwave, swatichouhan012, salah1, xjm,...

  • alexpott committed 119028b on 9.0.x
    Issue #3107732 by mondrake, longwave, swatichouhan012, salah1, xjm,...
alexpott’s picture

Title: Between April 13 and April 17, 2020: Add return typehints to setUp/tearDown methods in concrete test classes » Add return typehints to setUp/tearDown methods in concrete test classes

:D lol at the commit message.

Berdir’s picture

FIY, this also changed MigrateProcessTestCase, despite not having a Base suffix, this was a base class that also had subclasses in paragraphs and maybe other contrib modules :)

heddn’s picture

Yes, this is also effecting migrate_plus and other migrate contrib modules. See https://www.drupal.org/pift-ci-job/1662818

longwave’s picture

Opened #3131402: Remove return type hints from abstract test classes to deal with that specific case. Also crafted a regex which has discovered some others we may want to consider reverting - some of these are false positives as there are test implementations in the same file, but a few may warrant reverting still:

$ grep -rl 'setUp(): void' core|xargs grep ^abstract
core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php:abstract class SqlContentEntityStorageTestEntityInterface implements EntityInterface {
core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php:abstract class EntityTypeManagerTestEntity implements \Iterator, ContentEntityInterface {
core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php:abstract class TestEntityHandlerBase extends EntityHandlerBase {
core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php:abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
core/modules/migrate/tests/src/Unit/process/MigrationLookupTestCase.php:abstract class MigrationLookupTestCase extends MigrateProcessTestCase {
core/modules/tour/tests/src/Functional/TourTestBasic.php:abstract class TourTestBasic extends TourTestBase {
core/modules/locale/tests/src/Functional/LocaleUpdateBase.php:abstract class LocaleUpdateBase extends BrowserTestBase {
core/modules/media/tests/src/FunctionalJavascript/MediaSourceTestBase.php:abstract class MediaSourceTestBase extends MediaJavascriptTestBase {

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.