Tests based on BrowserTestBase and KernelTestBase have a $modules property that allows to specify the modules that should be enabled before executing the tests. This property had always been intended to be protected, and it was declared as such in the two base classes.
However in practice many tests in Drupal core prior to Drupal 9.0.0 changed the visibility to public. Over time this problem became worse, mainly because some popular base classes (such as EntityKernelTestBase) were changing this property public, forcing all their child classes to make this property public as well. While there is no harm in making this property public, it is useless and the need to check the actual visibility to use when writing a test was resulting in lost developer time.
Starting with Drupal 9.0.0 this property should now always be protected. In 9.1.0-alpha1 and above, making the property public will cause a deprecation to be thrown.
https://www.drupal.org/node/2909426
Tests based on
BrowserTestBase
andKernelTestBase
have a$modules
property that allows to specify the modules that should be enabled before executing the tests. This property had always been intended to be protected, and it was declared as such in the two base classes.However in practice many tests in Drupal core prior to Drupal 9.0.0 changed the visibility to public. Over time this problem became worse, mainly because some popular base classes (such as
EntityKernelTestBase
) were changing this property public, forcing all their child classes to make this property public as well. While there is no harm in making this property public, it is useless and the need to check the actual visibility to use when writing a test was resulting in lost developer time.Starting with Drupal 9.0.0 this property should now always be protected. In 9.1.0-alpha1 and above, making the property public will cause a deprecation to be thrown.