19declare(strict_types=1);
32 $this->
writeLang(
'lang/ilias_de.lang', [
'common#:#yes#:#Ja']);
33 $this->
writeLang(
'lang/customizing/ilias_de.lang.local', [
'common#:#yes#:#Jawohl',
'common#:#dup#:#Eigen']);
34 $this->duplicate_rows = [[
'module' =>
'other',
'identifier' =>
'dup']];
37 $unwritten = $manager->insertLanguageForInstallation(
'de');
39 $this->assertSame([], $unwritten,
'a skipped entry is no unwritten overlay');
40 $this->assertSame(
'Jawohl', $this->
lngModules()[
'common'][
'yes']);
41 $this->assertArrayNotHasKey(
'dup', $this->
lngModules()[
'common'],
'the entry is not applied');
42 $this->assertSame([
'de' => [
'common#:#dup' => [
'other: dup']]], $manager->getSkippedDuplicateEntries());
43 $this->assertStringContainsString(
'common#:#dup', $this->
loggedWarnings());
49 $this->
writeLang(
'lang/ilias_de.lang', [
'common#:#yes#:#Ja']);
50 $this->
writeLang(
'lang/customizing/ilias_de.lang.local', [
'common#:#dup#:#Eigen']);
51 $this->duplicate_rows = [[
'module' =>
'other',
'identifier' =>
'dup']];
53 $manager->insertLanguageForInstallation(
'de');
54 $this->assertNotSame([], $manager->getSkippedDuplicateEntries(),
'precondition');
56 $this->duplicate_rows = [];
57 $manager->insertLanguageForInstallation(
'de');
59 $this->assertSame([], $manager->getSkippedDuplicateEntries());
60 $this->assertSame(
'Eigen', $this->
lngModules()[
'common'][
'dup']);
66 $this->
writeLang(
'lang/ilias_de.lang', [
'common#:#dup#:#Shipped']);
67 $this->
writeLang(
'lang/customizing/ilias_de.lang.local', [
'common#:#dup#:#Eigen']);
68 $this->duplicate_rows = [[
'module' =>
'other',
'identifier' =>
'dup'], [
'module' =>
'common',
'identifier' =>
'dup']];
71 $manager->insertLanguageForInstallation(
'de');
73 $this->assertSame([], $manager->getSkippedDuplicateEntries());
74 $this->assertSame(
'Eigen', $this->
lngModules()[
'common'][
'dup']);
84 #[\PHPUnit\Framework\Attributes\DataProvider('entriesOfTheSameRun')]
88 $this->
writeLang(
'lang/ilias_de.lang', $shipped_lang_lines);
89 if ($shipped_po !==
null) {
90 $this->
shipPo($shipped_po);
92 $this->
writeLang(
'lang/customizing/ilias_de.lang.local', [
'common#:#dup#:#Eigen']);
95 $manager->insertLanguageForInstallation(
'de');
97 $this->assertSame([
'de' => [
'common#:#dup' => [$expected_duplicate]]], $manager->getSkippedDuplicateEntries());
98 $this->assertArrayNotHasKey(
'dup', $this->
lngModules()[
'common'] ?? []);
105 'a line of the shipped language file' => [[
'other#:#dup#:#Shipped'],
null,
'other: dup'],
106 'another spelling in the shipped language file' => [[
'other#:#DUP#:#Shipped'],
null,
'other: DUP'],
107 'an entry of a shipped .po' => [[
'common#:#yes#:#Ja'], [
'dup' =>
'Aus der PO'],
'pilot: dup'],
114 $this->
shipPo([
'greeting' =>
'Hallo']);
116 $this->
writeLang(
'lang/customizing/ilias_de.lang.local', [
'pilot#:#extra#:#Eigen']);
117 $this->duplicate_rows = [[
'module' =>
'other',
'identifier' =>
'extra']];
120 $manager->insertLanguageForInstallation(
'de');
122 $this->assertSame([
'pilot2'], $this->
takenOver());
123 $this->assertArrayHasKey(
'pilot#:#extra', $manager->getSkippedDuplicateEntries()[
'de'] ?? []);
125 $this->duplicate_rows = [];
126 $manager->insertLanguageForInstallation(
'de');
128 $this->assertSame([self::MODULE,
'pilot2'], $this->
takenOver());
134 return MigratedLanguageFileSync::modulesWithLocalChangesTakenOver($this->root .
'/client-data',
'de');
Reads the shipped .po of a migrated module and maintains its per-installation overlay: the ....
A line of the customizing file whose identifier exists in another module or in another spelling is le...
testTheSkippedDuplicatesAreResetOnEveryInsertLanguageCall()
testEntriesOfTheSameRunCountAsExisting(array $shipped_lang_lines, ?array $shipped_po, string $expected_duplicate)
lng_data is emptied before an installation, so what this run writes besides counts as existing: the l...
testAModuleWithADuplicateCustomizingEntryIsNotRecordedUntilItIsFixed()
testACustomizingEntryWhoseIdentifierExistsInAnotherModuleIsSkippedButTheRestIsInstalled()
testAnOldCollisionOfTheOwnModuleIsApplied()
An old collision stays editable: the own module holds the identifier in this very spelling.
static entriesOfTheSameRun()
Fixtures of the LanguageInstallationManager tests for modules migrated to PO/MO ("pilot").
shipPo(array $entries, string $lang_key='de')
shipSecondModule(array $entries)
A second migrated module "pilot2" next to "pilot".
manager(?\Closure $client_data_dir_resolver=null, ?\Closure $language_cache_invalidator=null, bool $with_resolver=true, bool $with_logger=true, ?LoggerInterface $logger=null)
writeLang(string $relative_file, array $lines)