Skip to content

Commit e218096

Browse files
committed
2 parents f5464ec + 8488f0c commit e218096

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

dev/tests/static/testsuite/Magento/Test/Php/LogCodesTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
class LogCodesTest extends \PHPUnit\Framework\TestCase
3434
{
35-
private const LOG_CODE_REGEX = '/\bCDE(\d{2})-(\d{2})\b/';
35+
private const LOG_CODE_REGEX = '/\b([A-Z]{3})(\d{2})-(\d{2})\b/';
3636
private const LOG_LEVELS = ['error', 'warning', 'critical'];
3737

3838
public function testChangedFilesHaveValidLogCodes(): void
@@ -112,12 +112,13 @@ function () {
112112
*/
113113
private function loadRegistryByCode(): ?array
114114
{
115-
$registryPath = BP . '/dev/tests/log-codes.md';
116-
117-
$entries = $this->parseRegistry((string) file_get_contents($registryPath));
118115
$index = [];
119-
foreach ($entries as $entry) {
120-
$index[$entry['code']] = $entry;
116+
// Merge every per-source registry: the base `log-codes.md` plus suffixed ones
117+
// (e.g. `log-codes-ccdm-b2b.md`) each source ships, so connectors own their own codes.
118+
foreach (glob(BP . '/dev/tests/log-codes*.md') as $registryPath) {
119+
foreach ($this->parseRegistry((string) file_get_contents($registryPath)) as $entry) {
120+
$index[$entry['code']] = $entry;
121+
}
121122
}
122123
return $index;
123124
}
@@ -128,7 +129,7 @@ private function loadRegistryByCode(): ?array
128129
private function parseRegistry(string $markdown): array
129130
{
130131
$entries = [];
131-
$rowPattern = '/^\|\s*(CDE\d{2}-\d{2})\s*\|\s*([a-zA-Z]+)\s*\|\s*`([^`]+)`\s*\|\s*`([^`]+)`\s*\|\s*$/m';
132+
$rowPattern = '/^\|\s*([A-Z]{3}\d{2}-\d{2})\s*\|\s*([a-zA-Z]+)\s*\|\s*`([^`]+)`\s*\|\s*`([^`]+)`\s*\|\s*$/m';
132133
if (!preg_match_all($rowPattern, $markdown, $rows, PREG_SET_ORDER)) {
133134
return [];
134135
}

0 commit comments

Comments
 (0)