From 05e05377f98766193fc0e015b00f82f83d22a40a Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 21 May 2024 10:21:41 +1200 Subject: [PATCH] ENH If a wildcard is used it must be the only entry --- README.md | 2 +- tests/MetaDataTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4fcdbc..fd5bcd6 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Each of the above sections holds an array of JSON objects with the following dat |`isCore`|_Boolean_|Is this considered a direct dependency of `silverstripe/installer`, `silverstripe/recipe-cms` or `silverstripe/recipe-core`? (Only relevant for supported modules)| |`lockstepped`|_Boolean_|Whether this is _always_ given a new minor release in "lock step" with Silverstripe CMS as a whole. (Only relevant for supported modules)| |`type`|_String_|One of "module", "recipe", "theme", or "other". (Only relevant for supported modules)| -|`majorVersionMapping`|_Object_|A map of major versions, with the Silverstripe CMS major release lines as object keys and an array of all matching major release lines for the repository as values.
• The repository versions are branch names, but in most cases these will map to a major release line (e.g. "5" branch which represents the "5.x" release line)
• If a `"*"` key is present, it should be used for any CMS major release lines which do not have their own keys.
• If a CMS major release line is missing, and there is no `"*"` key, the repository should be ignored for that CMS major release line.
• If the value is an empty array, the default branch should be used.| +|`majorVersionMapping`|_Object_|A map of major versions, with the Silverstripe CMS major release lines as object keys and an array of all matching major release lines for the repository as values.
• The repository versions are branch names, but in most cases these will map to a major release line (e.g. "5" branch which represents the "5.x" release line)
• If a `"*"` key is present it will be used for all CMS major release lines, and no other keys can be used
• If a CMS major release line is missing, and the `"*"` key is not used, the repository should be ignored for that CMS major release line.
• If the value is an empty array, the default branch should be used.| ## Adding a repo diff --git a/tests/MetaDataTest.php b/tests/MetaDataTest.php index 1b80e2c..429bc5f 100644 --- a/tests/MetaDataTest.php +++ b/tests/MetaDataTest.php @@ -287,5 +287,8 @@ private function validateVersionMap(array $versionMap): void $this->assertNotEmpty($branches); } } + if (array_key_exists('*', $versionMap)) { + $this->assertCount(1, array_keys($versionMap), 'If a wildcard is defined, it must be the only key.'); + } } }