Skip to content

Modernize phpunit_example module for Drupal 11 #470

Description

@tormi

Summary

web/modules/custom/phpunit_example is still framed as a Drupal 8-era example and has outdated guidance for a Drupal 11 codebase.

Current outdated parts

  • phpunit_example.module says "Drupal 8 unit testing" in the docs block.
  • AddClassTest explanatory comments still reference legacy PHPUnit patterns (\PHPUnit_Framework_TestCase, setExpectedException(), and annotation-based metadata wording).
  • phpunit_example.info.yml declares a drupal:node dependency that is not used by the module code.

Why this matters

The project now runs on Drupal 11 / PHPUnit 11. Keeping the sample module wording and dependencies current avoids confusion and prevents unnecessary package coupling.

Suggested scope

  • Update module/test documentation text to Drupal 11 + PHPUnit 11 terminology.
  • Remove stale legacy references from test comments.
  • Remove unused drupal:node dependency from phpunit_example.info.yml (if no hidden runtime use exists).
  • Keep functional behavior of AddClass and its tests unchanged.

Verification

  • ddev phpunit --testsuite unit --configuration phpunit.xml --display-deprecations --display-phpunit-deprecations
  • Optional: ddev grumphp run

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions