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:
Warnings of deprecation code and coding standards
Line phpunit_example/tests/src/Unit/AddClassTest.php
------ -------------------------------------------------------------------
114 Call to deprecated method setExpectedException() of class
Drupal\Tests\UnitTestCase:
in drupal:8.8.0 and is removed from drupal:9.0.0.
Backward compatibility for PHPUnit 4 will no longer be supported.
Line phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php
------ -------------------------------------------------------------------
113 Call to deprecated method setExpectedException() of class
Drupal\Tests\UnitTestCase:
in drupal:8.8.0 and is removed from drupal:9.0.0.
Backward compatibility for PHPUnit 4 will no longer be supported.
143 Call to deprecated method setExpectedException() of class
Drupal\Tests\UnitTestCase:
in drupal:8.8.0 and is removed from drupal:9.0.0.
Backward compatibility for PHPUnit 4 will no longer be supported.
1x: Drupal\Tests\BrowserTestBase::$defaultTheme is required in drupal:9.0.0 when using an install profile that does not set a default theme. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.
1x in PHPUnitExampleMenuTest::testLinksAndPages from Drupal\Tests\phpunit_example\Functional
FILE: examples/phpunit_example/src/ProtectedPrivates.php
--------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------
52 | WARNING | Unused private method privateAdd()
--------------------------------------------------------------------------------------------------------
FILE: examples/phpunit_example/src/DisplayManager.php
-----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
20 | ERROR | Missing member variable doc comment
--------------------------------------------------------------------------------
Comment | File | Size | Author |
---|---|---|---|
#8 | phpunit-example-3072441-8.patch | 3.99 KB | jungle |
Comments
Comment #2
Malevi4 CreditAttribution: Malevi4 at Drupal Ukraine Community commentedComment #3
Malevi4 CreditAttribution: Malevi4 at Drupal Ukraine Community commentedAdd patch replace_deprecated_class-3072441-1.patch
Comment #4
osab CreditAttribution: osab as a volunteer and at AnyforSoft, Drupal Ukraine Community, Happy Coding for Drupal Ukraine Community commentedComment #5
andypostComment #6
Kristen PolPer a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.
Comment #7
jungleThere are two more tiny issues in the phpunit_example module, for which I do not want to create new issues. So I'd submit a little big patch in one go to get the whole module looks good again here.
Comment #8
jungleBTW, the attached patch passed on my local.
Comment #9
jungleComment #10
jungleComment #12
marvil07 CreditAttribution: marvil07 as a volunteer commentedThanks for all contributions here!
I ran tests for the phpunit_example module locally, before and after the latest patch; and indeed fixes the problem, as mainly mentioned on the related change record.
I am not fully convinced of this change, but since it is mainly used from tests itself, I am OK with for now.
We can revert this hunk if needed in the future.