Problem/Motivation
The Purge module's test suite uses patterns that are deprecated in PHPUnit 10/11 and removed in PHPUnit 12. This will cause test failures when Drupal core requires PHPUnit 12.
Steps to reproduce
Proposed resolution
Modernize all unit tests for PHPUnit 12 compatibility, eliminating all deprecation warnings.
Annotations → Attributes
@dataProvider→#[DataProvider('methodName')]@group→#[Group('name')]@coversDefaultClass→#[CoversClass(ClassName::class)]or#[CoversTrait(TraitName::class)]- Remove method-level
@covers ::methodName(not supported as attributes)
Data Providers
- Change from
protected functiontopublic static function
Mock Methods
->will($this->returnValue($x))→->willReturn($x)->will($this->returnValueMap([...]))→->willReturnMap([...])
Trait Mocking
- Replace deprecated
getMockForTrait()with anonymous class pattern
Interface Mocking
- Fix incorrect
getMockForAbstractClass()on interface →createMock()
Code Quality
- Add docblocks to all test classes and methods
- Fix indentation inconsistencies
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork purge-3587982
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
Comment #3
kim.pepperComment #4
kim.pepperThis is ready for review. Disclaimer: I used Claude Code to help automate a lot of bulk changes in this MR.
Comment #5
andypostLooks ready to go! Thank you
Comment #6
japerryComment #7
japerryUpdated the MR to add the group tags missing.
Comment #8
japerryThanks @kim.pepper for this. Made a few changes and committed. We'll follow up anything in #3590026: Drupal 12 + PHP Compatibility
Comment #11
kim.pepperNice. Thank you!