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
Follow-up of #3037228: Add more test coverage to Help Topics.
Class Constant Visibility support was added at PHP 7.1.
PHP 7.1.0 Released
PHP RFC: Support Class Constant Visibility
The new test HelpTopicTwigTest fails at PHP 7 (8.8.x-dev test with PHP 7 & MySQL 5.5
).
Unknown
fail: [run-tests.sh check] Line 0 of :
FATAL Drupal\Tests\help_topics\Unit\HelpTopicTwigTest: test runner returned a non-zero error code (255).
https://www.drupal.org/pift-ci-job/1422958
https://www.drupal.org/pift-ci-job/1423765
Proposed resolution
--- a/core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php
+++ b/core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php
@@ -30,7 +30,7 @@ class HelpTopicTwigTest extends UnitTestCase {
*
* @var array
*/
- protected const PLUGIN_INFORMATION = [
+ const PLUGIN_INFORMATION = [
'id' => 'test.topic',
'provider' => 'test',
'label' => 'This is the topic label',
Comment | File | Size | Author |
---|---|---|---|
#2 | 3085512-2.patch | 571 bytes | Krzysztof Domański |
Comments
Comment #2
Krzysztof DomańskiComment #3
andypostNice catch, otoh making it public require to mark it as internal
Also core could move to 7.2 soon
Comment #4
jhodgdonThis looks like a straightforward fix that will let the tests pass on older versions of PHP. Assuming the tests come back green, this looks RTBC to me. Thanks!
Tests are automatically internal, so I don't think we need to add to the docs header.
Comment #5
Krzysztof DomańskiUnrelated test failure https://www.drupal.org/pift-ci-job/1423834.
Comment #6
alexpottCommitted b8d834e and pushed to 8.8.x. Thanks!