Problem/Motivation

Running the unit test JsonLogTest.php produces an additional deprecation running PHPUnit version 10:

Test Triggered PHPUnit Deprecation (Drupal\Tests\jsonlog\Unit\JsonLogTest::testLogChannelFilter)
Data Provider method Drupal\Tests\jsonlog\Unit\JsonLogTest::logChannelFilterProvider() is not static

Steps to reproduce

Run jsonlog/tests/src/Unit/JsonLogTest.php with PHPUnit Version 10 on Drupal 11

Proposed resolution

Easy fix to make the function static.
Does not introduce a deprecation.
Also good to remove unused use statements.

Remaining tasks

X Create issue fork
X Create Merge Request
- Test
- Merge into 4.x-dev

User interface changes

None

API changes

None

Data model changes

None

Issue fork jsonlog-3471285

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

scott_earnest created an issue. See original summary.

scott_earnest’s picture

Issue summary: View changes
Status: Active » Needs review
mradcliffe’s picture

This looks good to me.

Potentially setting core_version_requirement to ^10.3 || ^11 might help for the next stable release as well in case anyone one who hasn't gotten to 10.3 tries to update and runs tests. That could also be done in the other issue as well.

jacobfriis’s picture

@scott_earnest Great work! But this will not be (backwards)compatible with PHPunit 9 I presume?
In that case we'll probably have to create an new D11 line (dev branch + major version). Will do for sure, but slightly later.

mradcliffe’s picture

But this will not be (backwards)compatible with PHPunit 9 I presume?

It should be easy to figure out by adding test previous major into gitlab CI yaml. I needed to add that anyway to most of my modules because of the flip to testing Drupal 11 as the current major.

Edit: I notice _TARGET_CORE is explicitly set to 10.1 and _TARGET_PHP to 8.1. Maybe that should change to

  OPT_IN_TEST_PREVIOUS_MAJOR: '1'
  OPT_IN_TEST_NEXT_MAJOR: '1'

composer (next major):
  allow_failure: true

That should flip the test matrix to 10 and 11 and then 10, 11 and 12 once 12 is branched. What do you think?

mradcliffe’s picture

Also the test run from 3 months ago passes on PHPUnit 9:

PHPUnit 9.6.20 by Sebastian Bergmann and contributors.
..................................                                34 / 34 (100%)
Time: 00:02.545, Memory: 6.00 MB
mradcliffe’s picture

I went ahead and just made the change in the merge request.

This proves the merge request works as-is with the 4.x branch on Drupal 10 and will work with Drupal 11 as soon as #3455244: Automated Drupal 11 compatibility fixes for jsonlog is merged as well.

lorenzs’s picture

Version: 4.x-dev » 4.1.0
Assigned: scott_earnest » Unassigned
Status: Needs review » Fixed

Included in another D11 MR and released in version 4.1.0.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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