Skip to content

Commit 99c9b86

Browse files
committed
fpm: Add substitution function to test helper class "logtool"
1 parent 1c90827 commit 99c9b86

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sapi/fpm/tests/logtool.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,13 @@ class LogTool
363363
$expectedMessage = '\[pool ' . $pool . '\] ' . $expectedMessage;
364364
}
365365

366+
// Allow expected message to contain %s and %s for any string or number
367+
// as in run-tests.php
368+
$expectRe = str_replace('%s', '[^\r\n]+', $expectedMessage);
369+
$expectRe = str_replace('%d', '\d+', $expectRe);
370+
366371
$line = rtrim($line);
367-
$pattern = sprintf('/^(%s )?%s: %s$/', self::P_TIME, $type, $expectedMessage);
372+
$pattern = sprintf('/^(%s )?%s: %s$/', self::P_TIME, $type, $expectRe);
368373

369374
if (preg_match($pattern, $line, $matches) === 0) {
370375
return $this->error(

0 commit comments

Comments
 (0)