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',
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Krzysztof Domański created an issue. See original summary.

Krzysztof Domański’s picture

andypost’s picture

Nice catch, otoh making it public require to mark it as internal
Also core could move to 7.2 soon

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

This 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.

Krzysztof Domański’s picture

Title: Remove Class Constant Visibility from HelpTopicTwigTest » Remove Class Constant Visibility from HelpTopicTwigTest which breaks tests at PHP 7
Issue tags: +Quick fix
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed b8d834e and pushed to 8.8.x. Thanks!

  • alexpott committed b8d834e on 8.8.x
    Issue #3085512 by Krzysztof Domański: Remove Class Constant Visibility...

Status: Fixed » Closed (fixed)

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