Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
Attempting to run PHPUnit on a module that depends on CAPTCHA v1.2.0. generates an access level error for the $modules
property on a number of testing classes:
PHP Fatal error: Access level to Drupal\Tests\captcha\Kernel\Migrate\d7\MigrateCaptchaPointsTest::$modules must be public (as in class Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase) in modules/contrib/captcha/tests/src/Kernel/Migrate/d7/MigrateCaptchaPointsTest.php on line 94
Steps to reproduce
Proposed resolution
Change property access level from protected
to public
.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
captcha-module-property-access-level.patch | 2.96 KB | collinhaines | |
|
Comments
Comment #2
johne CreditAttribution: johne at Unleashed Technologies commentedI can confirm this patch fixes the issue.
Comment #3
davidwhthomas CreditAttribution: davidwhthomas commentedThanks, also confirming the patch fixed the issue.
Comment #5
japerryComment #6
collinhaines CreditAttribution: collinhaines commentedI believe this is no longer a relevant issue.
Starting in Drupal 9, the
$modules
property in tests should beprotected
as per the change record. I was running into this issue on a Drupal 8 site at the time of creating this issue, not knowing that Drupal 9 was enforcing the protected access level.Comment #7
japerryCorrect, I'll get this reverted and up the requirement to 9.2 instead with D10 readiness.