Fixed
Project:
Content First
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
12 May 2026 at 09:59 UTC
Updated:
12 May 2026 at 13:06 UTC
Jump to comment: Most recent
Fix PHPUnit 11 doc-comment metadata deprecations in unit tests
PHPUnit 11 deprecates metadata placed in doc-comments (@group, @covers, @dataProvider). These will no longer be supported in PHPUnit 12. Running the test suite currently reports 12 deprecation notices:
There were 12 PHPUnit test runner deprecations: 1) Metadata found in doc-comment for class Drupal\Tests\content_first_audit\Unit\AuditHooksTest. Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead. ... The affected test classes are:
Drupal\Tests\content_first_audit\Unit\AuditHooksTestDrupal\Tests\content_first_audit\Unit\AuditRepositoryTestDrupal\Tests\content_first\Unit\ContentFirstCommandsTestDrupal\Tests\content_first\Unit\ContentFirstFilenameTestDrupal\Tests\content_first\Unit\HeadingAnalyzerTestDrupal\Tests\content_first\Unit\HtmlSelectorRemoverTestDrupal\Tests\content_first\Unit\HtmlTagTransformerTestDrupal\Tests\content_first\Unit\RenderedContentTest (also has method-level @dataProvider annotations)Replace all doc-comment metadata annotations with the equivalent PHP 8 attributes from PHPUnit\Framework\Attributes:
@group → #[Group('...')]@covers → #[CoversClass(...::class)]@dataProvider → #[DataProvider('...')]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
gedur commented