Problem/Motivation
In #2313917-108: Core version key in module's .info.yml doesn't respect core semantic versioning we are changing the core:
key in .info.yml file to support more than 8.x
, for example ^8 || ^9
or ^8.6.7
Because there is core key server urls used by the Locale module we were worried that changing this key would affect the urls.
It appeared in locale_translation_build_projects()
t
'core' => isset($data['info']['core']) ? $data['info']['core'] : \Drupal::CORE_COMPATIBILITY,
Was setting the core key from info.yml files if set.
But because \Drupal\Core\Utility\ProjectInfo::filterProjectInfo()
filters out the core key the value will never originate from the .info.yml file
The problem is that this not clear that this was intentional and that there is test coverage that would break if it were to change, for example by adding 'core' to the hardcoded whitelist in \Drupal\Core\Utility\ProjectInfo::filterProjectInfo()
or to the $additional_whitelist
whitelist sent from locale_translation_project_list()
Proposed resolution
Add a test that proves that the altering the core and name keys will not affect these keys as returned by
Remaining tasks
Make the test
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#5 | 3070354-5.patch | 3.5 KB | Wim Leers |
#5 | interdiff.txt | 1.17 KB | Wim Leers |
#4 | 3070354-4.patch | 3.51 KB | Wim Leers |
#4 | interdiff.txt | 3.75 KB | Wim Leers |
#2 | 3070354-2-new-test.patch | 3.53 KB | tedbow |
Comments
Comment #2
tedbowHere are a few of patches
1,2 have drupalci.yml changes to only run locale module tests.
Comment #4
Wim Leers#2313917-110: Core version key in module's .info.yml doesn't respect core semantic versioning.2 pointed me here. I've read the related comments there. Excellent find! This patch removes some ambiguity, it enables us to make changes with confidence. Well done! 👍
Found a bunch of nits. Fixed them all.
Nit: s/effect/affect/
s/Tests for/Tests/
Nit: s/built ./built./
Nit: we should use
assertSame()
wherever possible.Nit: s/in $module->info/in $module->info/
Comment #5
Wim LeersI forgot to fix points 3 and 5. Done now.
Comment #6
xjmShouldn't we be doing something to the (presumably) dead code path in
locale.compare.inc
here? Removing it, or at least an@todo
or deprecation or something?Also what about the seemingly related use of the constant in
install_check_translations()
?Comment #7
xjmRelated note from Gábor: #2313917-107: Core version key in module's .info.yml doesn't respect core semantic versioning
Comment #8
xjmComment #9
tedbowre #7
install_check_translations()
uses'%core' => \Drupal::CORE_COMPATIBILITY,
but it doesn't have any code that appears to the get the 'core' key from project infore #7
I think @Gábor was referring to this issue #3016471: Make localization file download major version agnostic it is postponed on some d.o changes
Comment #10
Gábor HojtsyWhile #2313917: Core version key in module's .info.yml doesn't respect core semantic versioning does not actually want to change the core key anymore, it will be possible that a core key will not be present after that patch. Since that patch is not yet in, this does not need to test for a missing core key, but that would be the next step IMHO add test coverage for at least for this case. I think this looks fine to cover testing what this meant to.
Comment #11
Gábor Hojtsy