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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

collinhaines created an issue. See original summary.

johne’s picture

Status: Active » Reviewed & tested by the community

I can confirm this patch fixes the issue.

davidwhthomas’s picture

Thanks, also confirming the patch fixed the issue.

  • japerry committed db05569 on 8.x-1.x authored by collinhaines
    Issue #3211466 by collinhaines: Testing modules property Access Level
    
japerry’s picture

Status: Reviewed & tested by the community » Fixed
collinhaines’s picture

I believe this is no longer a relevant issue.

Starting in Drupal 9, the $modules property in tests should be protected 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.

japerry’s picture

Correct, I'll get this reverted and up the requirement to 9.2 instead with D10 readiness.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.