Skip to content

Commit

Permalink
Update preset regex and simplify Readme test
Browse files Browse the repository at this point in the history
Removed the unnecessary YML content manipulation from the Readme test in ReadmeTest.php. Furthermore, updated the regex pattern for alias in presets in the README.md file to case insensitive, easing the matching process. Improved the readability of the description for the preset_database.yml.
  • Loading branch information
SmetDenis committed Apr 6, 2024
1 parent dcb15c5 commit eaa839b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,8 @@ In fact, this can be considered as partial inheritance.
- Schemas with presets validate themselves and if there are any obvious issues, you will see them when you try to use
the schema.
- Alias in presets must match the regex pattern
<!-- auto-update:preset-regex -->`/^[a-z0-9-_]+$/i`<!-- auto-update:/preset-regex -->.
<!-- auto-update:preset-regex --> `"/^[a-z0-9-_]+$/i"` <!-- auto-update:/preset-regex -->.
Otherwise, it might break the syntax.


Let's take a look at what this looks like in code.
Expand Down
2 changes: 1 addition & 1 deletion tests/ReadmeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function testCheckPresetFeaturesExampleInReadme(): void
public function testCheckPresetRegexInReadme(): void
{
$text = SchemaDataPrep::getAliasRegex();
Tools::insertInReadme('preset-regex', "`{$text}`", true);
Tools::insertInReadme('preset-regex', " `\"{$text}\"` ", true);
}

public function testCheckPresetDatabaseExampleInReadme(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static function insertInReadme(string $code, string $content, bool $isInl
if ($isInline) {
$replacement = \implode('', [
"<!-- {$prefix}{$code} -->",
\trim($content),
$content,
"<!-- {$prefix}/{$code} -->",
]);
} else {
Expand Down

0 comments on commit eaa839b

Please sign in to comment.