19declare(strict_types=1);
28use PHPUnit\Framework\TestCase;
34 $lng = $this->createStub(Language::class);
42 return new Refinery($this->createStub(DataFactory::class), $this->createStub(Language::class));
48 'tos#:#x (common: x, mme: X)',
56 $this->
lng(
'Not unique: %s'),
58 [
'a#:#<b> (x: "<b>")',
'c#:#d (e: d)']
61 $this->assertSame(
'Not unique: a#:#<b> (x: "<b>"); c#:#d (e: d)',
$message);
68 'Not unique 100% right. a (b: a)',
72 '100% unique: a (b: a)',
83 $entries[] =
'e' . $i;
90 $this->assertStringContainsString(
'… (+5)',
$message);
97 for ($i = 1; $i < 250; $i++) {
98 $entries[] =
'e' . $i;
103 $this->assertStringContainsString(
str_repeat(
'k', 199) .
'…; e1; ', $line);
104 $this->assertStringNotContainsString(
str_repeat(
'k', 200), $line);
105 $this->assertStringContainsString(
'e199', $line);
106 $this->assertStringNotContainsString(
'e200;', $line);
107 $this->assertStringEndsWith(
' … (+50)', $line);
114 $this->assertStringContainsString(
'a#:#b?[31m (c: b)', $line);
115 $this->assertStringNotContainsString(
'(+', $line);
116 $this->assertStringNotContainsString(
"\x1b", $line);
Texts naming entries left out or rejected because their identifier exists in another module (see Iden...
static entry(string $key, array $existing)
static of(Language $lng, Refinery $refinery, array $entries)
static forLog(array $entries)
Text taken from language files or entries (keys, values, file names) for a terminal or log line: cont...
const int MAX_LISTED_KEYS
testTheLogLineWithFewEntriesHasNoRemainderAndNoControlCharacters()
testAnEntryNamesItsKeyAndWhatItWouldDuplicate()
testEntriesAreShortenedAndTheListIsLimited()
The keys come from an uploaded file: one entry is cut to 200 characters, the list to the first entrie...
testTheLogLineHoldsAtMostTwoHundredShortenedEntriesAndCountsTheRest()
testTheMessageEscapesTheKeysAndFillsThePlaceholder()
testATextWithoutPlaceholderGetsTheListAppendedAndAFurtherPercentSignIsKept()
A translation without the placeholder, or with another "%", still names the entries and does not fail...