Skip to content

Commit aeb3a58

Browse files
committed
B2B-582: Update history log messages for Order Approvals
- fix integrity test to detect all sprintf placeholders
1 parent 522878e commit aeb3a58

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/ArgumentsTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ private function checkArgumentMismatch($phrase, &$incorrectNumberOfArgumentsErro
9999
{
100100
if (preg_match_all('/%(\w+)/', $phrase['phrase'], $matches) || $phrase['arguments']) {
101101
$placeholderCount = count(array_unique($matches[1]));
102-
// count all occurrences of %s
103-
preg_match_all('/%s/', $phrase['phrase'], $sprintfMatches);
104-
if (count($sprintfMatches[0]) > 1) {
105-
$placeholderCount = $placeholderCount + count($sprintfMatches[0]) - 1;
102+
// count all occurrences of sprintf placeholders
103+
preg_match_all('/%([sducoxXbgGeEfF])/', $phrase['phrase'], $sprintfMatches);
104+
if (count($sprintfMatches[0]) > count(array_unique($sprintfMatches[0]))) {
105+
$placeholderCount = $placeholderCount + count($sprintfMatches[0]) - count(array_unique($sprintfMatches[0]));
106106
}
107107

108-
// Check for zend placeholders %placeholder% and sprintf placeholder %s
109-
if (preg_match_all('/%((s)|([A-Za-z]+)%)/', $phrase['phrase'], $placeHolders, PREG_OFFSET_CAPTURE)) {
108+
// Check for zend placeholders %placeholder% and sprintf placeholders
109+
if (preg_match_all('/%(([sducoxXbgGeEfF])|([A-Za-z]+)%)/', $phrase['phrase'], $placeHolders, PREG_OFFSET_CAPTURE)) {
110110
foreach ($placeHolders[0] as $ph) {
111111
// Check if char after placeholder is not a digit or letter
112112
$charAfterPh = $phrase['phrase'][$ph[1] + strlen($ph[0])];

0 commit comments

Comments
 (0)