In #3102261: Update composer.json and rules.info.yml to require core 8.7 we made the change to rules.info.yml

- core: 8.x
+ core_version_requirement: ^8.7.7

At core 8.9 we now have three coding standards messages stating that this should also be added to the test files too.

---------------------------------------------------------------------------------------
 1 | WARNING | "core_version_requirement" property is missing in the info.yml file
   |         | (DrupalPractice.InfoFiles.CoreVersionRequirement.CoreVersionRequirement)
---------------------------------------------------------------------------------------

We can leave the requirement at 8.7.7 for the time being, we just need that 'core_version_requirement' key in the files.

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new1.54 KB

Patch with +core_version_requirement: ^8.7.7 for the three test modules

megachriz’s picture

@jonathan1055
If I'm correct, then core_version_requirement doesn't have to be added to test modules. What I think needs to be done instead is removing the core key. The dev version of Rules now requires Drupal 8.8, so removing the core key does no harm either.

megachriz’s picture

From https://www.drupal.org/node/3070687:

Note that test modules can omit the core_version_requirement key entirely as of Drupal 8.8.2, so that they will work with any core version they are tested against. Prior to 8.8.2, the value is required for test modules and will cause site errors if it is not included.

jonathan1055’s picture

StatusFileSize
new150 KB

For info, the tests were clean on 7th April, but by 19th April we had these three warnings. It was probably a new version of Coder which introduced the check.

core version requirement

[edit: cross posted, before I had seen the comments above]

megachriz’s picture

For your interest, Feeds Extensible Parsers has a test module without keys core and core_version_requirement and no coding standard violation on that part: https://www.drupal.org/pift-ci-job/1762066

Feeds has neither a coding standard violation on missing the core_version_requirement key for test modules: https://www.drupal.org/pift-ci-job/1756232

jonathan1055’s picture

Title: Add "core_version_requirement" to 3 test files, to align with rules.info.yml » Change package to 'Testing' for three test files
StatusFileSize
new1.5 KB

Thanks for the info MegaChriz. Yes I thought I had read somewhere about test modules needing neither 'core' nor 'core_version_requirement'. I just tried removing both and in my Travis build all the tests failed dramatically with

There were 71 errors:
Drupal\Core\Extension\InfoParserException: The 'core' or the 'core_version_requirement' key must be present in modules/rules/tests/modules/rules_test/rules_test.info.yml

PHPCS locally was also still giving me the 3 coding standards messages. So I searched the Coder commit log, found issue #3104236: Add test for `core_version_requirement` key in `info.yml` files? and sure enough it does say "check for the core_version_requirement key in *.info.yml files, excluding info files of test modules".

So I checked DrupalPractice/Sniffs/InfoFiles/CoreVersionRequirementSniff.php and it verifies that the file is a test file, not by the file location, but by checking that the package is 'Testing'. The rules files all have package: Rules. So with that change and removing Core: 8.x it works. I no longer get the coding standards messages, and the Travis test builds all run properly.

Let's see what drupal.org testbot says

tr’s picture

These changes require core 8.8.2+, and we've committed all sorts of patches from #3089502: [meta] Rules deprecated code in the past few days, so 8.7.7 is no longer accurate in rules.info.yml. Let's change this at the same time.

jonathan1055’s picture

Let's change this at the same time.

Good idea. Just queued a test at Core 8.8, but I think it was probably a waste of time, as the selection gave 8.8.8 anyway. Still, it will give us assurance.

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

RTBC

  • TR committed fc755a7 on 8.x-3.x authored by jonathan1055
    Issue #3160795 by jonathan1055, MegaChriz, TR: Change package to '...
tr’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

tr’s picture

And we should really update the core version requirement in composer.json as well, as long as we're doing this.

tr’s picture

The PHP 7.4 test in #13 was failing because of #3158445: Composer require failure due to "Failed to execute git clone" in drupalci/php-7.4-apache. That's still not resolved. Instead of trying to squeeze this change into this already-fixed issue, I think I will just take care of it when we have to update composer.json for D9, which should be any day now ... Moving the above patch to #3162077: Update dependencies for D9

jonathan1055’s picture

Title: Change package to 'Testing' for three test files » Set core_version_requirement to ^8.8.2 and change three test modules to 'Testing' package

I was wondering about that composer failure, so thanks for the background. Yes leave this as fixed. I've altered to title to reflect the other significant change done here.

Status: Fixed » Closed (fixed)

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