JsonLogTest deprecation with PHPUnit version 10

Created on 30 August 2024, 4 months ago

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

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

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States scott_earnest

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

Merge Requests

Comments & Activities

  • Issue created by @scott_earnest
  • Pipeline finished with Success
    4 months ago
    Total: 167s
    #269601
  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States scott_earnest
  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    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.

  • πŸ‡©πŸ‡°Denmark jacobfriis

    @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.

  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    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.

  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    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
    
Production build 0.71.5 2024