Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Discovered via PHPStan in #3178534: Start running PHPStan on Drupal core (level 0) we have some test code that returns or otherwise uses the void result of a PHPUnit method, e.g.
------ ---------------------------------------------------------------------
Line core/modules/comment/tests/src/Functional/CommentPagerTest.php
------ ---------------------------------------------------------------------
227 Result of method PHPUnit\Framework\Assert::assertEquals() (void) is
used.
------ ---------------------------------------------------------------------
------ ------------------------------------------------------------------------------------------
Line core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php
------ ------------------------------------------------------------------------------------------
271 Result of method PHPUnit\Framework\Assert::assertEquals() (void) is
used.
------ ------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------
Line core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php
------ -------------------------------------------------------------------------
231 Result of method PHPUnit\Framework\Assert::assertEquals() (void) is
used.
232 Result of method PHPUnit\Framework\Assert::assertEquals() (void) is
used.
------ -------------------------------------------------------------------------
Steps to reproduce
For a full set of results see https://www.drupal.org/pift-ci-job/2114597 or any later run from the parent issue.
Proposed resolution
Fix these cases.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#3 | 3222783.patch | 8.67 KB | longwave |
Comments
Comment #2
longwaveThese are relatively new, this is probably due to #3131281: Replace assertEqual() with assertEquals()
Comment #3
longwaveComment #4
longwaveComment #5
mondrakeRTBC, let's cleanup dead returns. Is anything from #3131900: Refactor assertions that assign return values to variables still relevant after this, or can we close it outdated?
Comment #6
longwaveForgot about that one. Let's see what remains after this is committed.
Comment #8
catchCommitted e76b29a and pushed to 9.3.x. Thanks!