Skip to content

Commit 3cad86c

Browse files
committed
Add another test case
1 parent 31e6497 commit 3cad86c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/Logs/LogsAggregatorTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,23 @@ public static function messageFormattingDataProvider(): \Generator
6363
['value'],
6464
'Message with placeholders but incorrect number of values: %s, %s',
6565
];
66+
67+
yield [
68+
'Message with a percentage: 42%',
69+
[],
70+
'Message with a percentage: 42%',
71+
];
72+
73+
// This test case is a bit of an odd one, you would not expect this to happen in practice unless the user intended
74+
// to format the message but did not add the proper placeholder. On PHP 8+ this will return the message as is, but
75+
// on PHP 7 it will return the message without the percentage sign because some processing is done by `vsprintf`.
76+
// You would however more likely expect the previous test case where no values are provided when no placeholders are present
77+
yield [
78+
'Message with a percentage: 42%',
79+
['value'],
80+
\PHP_VERSION_ID >= 80000
81+
? 'Message with a percentage: 42%'
82+
: 'Message with a percentage: 42',
83+
];
6684
}
6785
}

0 commit comments

Comments
 (0)