Add #[Group] attributes for Core 11.2 and PHPUnit 11

Created on 31 May 2025, about 1 month ago

Problem/Motivation

In Core 11.2-dev 📌 Deprecate TestDiscovery test file scanning, use PHPUnit API instead Active was introduced, but broke Contrib testing and has been reverted.

Proposed resolution

Add #[Group('scheduler')] (or the appropriate group) to each phpunit test classes.

Remaining tasks

📌 Task
Status

Active

Version

2.0

Component

Testing

Created by

🇬🇧United Kingdom jonathan1055

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

Merge Requests

Comments & Activities

  • Issue created by @jonathan1055
  • Merge request !244#3527579 Ignore 3rd-party deprecations → (Merged) created by jonathan1055
  • 🇬🇧United Kingdom jonathan1055

    Need to remove the 3rd-party deprecation warnings so that we can see what actually needs to be done for Scheduler. Initial results as-is before any work, split by test @group:

    • scheduler - 23 tests triggered deprecations (all range between 54 and 74 deps) = too many add up accurately. Log is 41K lines
    • scheduler_api, 63 + 58 + 59 + 54 = 234 deprecations, log is 8K lines
    • scheduler_js - each test triggered 54 deprecations. Log is 3K, not too big.
    • scheduler_kernel - each test triggered 7-9 deprecations. Log 890 lines.
    • scheduler_rules_integration - each test triggered between 67-74 deprecations. Log is 8K lines
    • scheduler_workbench - 68 deprecations. Log 1300 lines.
  • 🇬🇧United Kingdom jonathan1055

    First round of 3rd-party ignores. Big improvements made:

    • scheduler - 23 tests triggered deprecations (12-15 deps each). Log is 12K lines
    • scheduler_api, each 12 - 13 deprecations, log is 2,900 lines
    • scheduler_js - each test triggered 11 deprecations. Log is 1,500
    • scheduler_kernel - each test triggered 7-9 deprecations. Log 890 lines (no change).
    • scheduler_rules_integration - each test triggered 16 deprecations. Log is 3,100 lines
    • scheduler_workbench - 22 deprecations. Log 880 lines.
  • Pipeline finished with Skipped
    18 days ago
    #524618
  • 🇬🇧United Kingdom jonathan1055

    After adding group attributes for scheduler_js

    Before: There were 27 PHPUnit test runner deprecations
    After: There were 18 PHPUnit test runner deprecations.
    The 9 removed messages were all

    Metadata found in doc-comment for class Drupal\Tests\scheduler\FunctionalJavascript\SchedulerJavascriptDefaultTimeTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.
    

    So that's good. Even though the @group scheduler_js<code> is still in the doc-comment, providing there is also the new <code>#[Group('scheduler_js')] then the phpunit test runner deprecation is not displayed. That should mean we can fix the code for the new core 11.2+ and still support testing at the old core versions.

  • 🇮🇹Italy mondrake 🇮🇹

    As per #3497431-107: Deprecate TestDiscovery test file scanning, use PHPUnit API instead , you may opt-out from reporting PHPUnit runner deprecations (if they're too noisy for now), by setting the env variable PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION to FALSE.

  • 🇬🇧United Kingdom jonathan1055

    Thanks, yes that worked. After adding #[DataProvider()] to go with each @dataProvider in the javascript tests we still had the message There were 9 PHPUnit test runner deprecations followed by 8 tests triggered 11 deprecations
    https://git.drupalcode.org/project/scheduler/-/jobs/5598340#L663

    With PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION: 0 we just get straight to 8 tests triggered 11 deprecations
    https://git.drupalcode.org/project/scheduler/-/jobs/5599415#L661

    Thanks also for raising 📌 Introduce PHPUNIT_FAIL_ON_PHPUNIT_DEPRECATION Active

Production build 0.71.5 2024