19declare(strict_types=1);
22use PHPUnit\Framework\TestCase;
41 private function call(array
$rows, array $final_entries, array $shipped_entries, array $remarks = []): array
43 $method = (
new ReflectionClass(LanguageInstallationManager::class))->getMethod(
'databaseRowsOfMigratedModule');
45 return $method->invoke(
null,
$rows, $final_entries, $shipped_entries, $remarks);
49 'poll_population [0]' =>
'Eine Stimmabgabe',
50 'poll_population [1]' =>
'%s Stimmabgaben',
51 'poll_population_singular' =>
'Eine Stimmabgabe',
61 'poll_population [0]' => [
'Eine Stimmabgabe',
null,
null],
62 'poll_population [1]' => [
'%s NEUE Stimmabgaben',
null,
null],
65 'poll_population [0]' =>
'Eine Stimmabgabe',
66 'poll_population [1]' =>
'%s NEUE Stimmabgaben',
69 $result = $this->
call(
$rows, $final_entries, self::SHIPPED);
71 $this->assertSame([
'poll_population' => [
'%s NEUE Stimmabgaben',
null,
null]], $result);
80 $rows = [
'poll_population_singular' => [
'Eine Stimmabgabe',
'2024-01-01 00:00:00',
'Anmerkung']];
82 $result = $this->
call(
$rows, [
'poll_population_singular' =>
'Eine Stimmabgabe'], self::SHIPPED);
85 [
'poll_population_singular' => [
'Eine Stimmabgabe',
'2024-01-01 00:00:00',
'Anmerkung']],
96 $rows = [
'poll_population_singular' => [
'Eine Stimmabgabe',
'2024-01-01 00:00:00',
'Alte Anmerkung']];
98 $result = $this->
call(
100 [
'poll_population_singular' =>
'Eine Stimmabgabe'],
102 [
'poll_population_singular' =>
'Neue Anmerkung']
106 [
'poll_population_singular' => [
'Eine Stimmabgabe',
'2024-01-01 00:00:00',
'Neue Anmerkung']],
114 'poll_population [0]' => [
'Eine Stimmabgabe',
null,
null],
115 'poll_population [1]' => [
'%s Stimmabgaben',
null,
'Alte Anmerkung'],
117 $final_entries = [
'poll_population [0]' =>
'Eine Stimmabgabe',
'poll_population [1]' =>
'%s Stimmabgaben'];
119 $result = $this->
call(
$rows, $final_entries, self::SHIPPED, [
'poll_population' =>
'Neue Anmerkung']);
121 $this->assertSame(
'Neue Anmerkung', $result[
'poll_population'][2]);
129 $rows = [
'poll_population_singular' => [
'Eine Stimmabgabe',
null,
'Eigene Anmerkung']];
131 $result = $this->
call(
$rows, [
'poll_population_singular' =>
'Eine Stimmabgabe'], self::SHIPPED, []);
133 $this->assertSame(
'Eigene Anmerkung', $result[
'poll_population_singular'][2]);
144 'poll_population [0]' => [
'Eine Stimmabgabe',
null,
null],
145 'poll_population [1]' => [
'%s Stimmabgaben',
'2024-01-01 00:00:00',
'lokal geändert'],
148 $final_entries = [
'poll_population [0]' =>
'Eine Stimmabgabe',
'poll_population [1]' =>
'%s Stimmabgaben'];
150 $result = $this->
call(
$rows, $final_entries, self::SHIPPED);
153 [
'poll_population' => [
'%s Stimmabgaben',
null,
'lokal geändert']],
165 'poll_population [0]' => [
'Eine Stimmabgabe',
null,
null],
166 'poll_population [1]' => [
'%s NEUE Stimmabgaben',
'2024-01-01 00:00:00',
'lokal geändert'],
168 $final_entries = [
'poll_population [0]' =>
'Eine Stimmabgabe',
'poll_population [1]' =>
'%s NEUE Stimmabgaben'];
170 $result = $this->
call(
$rows, $final_entries, self::SHIPPED);
173 [
'poll_population' => [
'%s NEUE Stimmabgaben',
'2024-01-01 00:00:00',
'lokal geändert']],
184 'poll_population [1]' => [
'%s NEUE Stimmabgaben',
'2024-01-01 00:00:00',
'lokal geändert'],
185 'poll_population [0]' => [
'Eine Stimmabgabe',
null,
null],
187 $final_entries = [
'poll_population [0]' =>
'Eine Stimmabgabe',
'poll_population [1]' =>
'%s NEUE Stimmabgaben'];
189 $result = $this->
call(
$rows, $final_entries, self::SHIPPED);
192 [
'poll_population' => [
'%s NEUE Stimmabgaben',
'2024-01-01 00:00:00',
'lokal geändert']],
203 'poll_population [0]' => [
'Eine Stimmabgabe',
null,
null],
204 'poll_population [1]' => [
'%s Stimmabgaben',
null,
null],
205 'poll_population_singular' => [
'Eine Stimmabgabe',
null,
null],
208 $final_entries = [
'poll_population_singular' =>
'Eine Stimmabgabe'];
210 $result = $this->
call(
$rows, $final_entries, self::SHIPPED);
212 $this->assertArrayNotHasKey(
'poll_population', $result);
213 $this->assertSame([
'poll_population_singular' => [
'Eine Stimmabgabe',
null,
null]], $result);
221 $shipped = [
'poll_population [0]' =>
'ある投票'];
222 $rows = [
'poll_population [0]' => [
'ある投票NEU',
null,
null]];
223 $final_entries = [
'poll_population [0]' =>
'ある投票NEU'];
225 $result = $this->
call(
$rows, $final_entries, $shipped);
227 $this->assertSame([
'poll_population' => [
'ある投票NEU',
null,
null]], $result);
trait RestoresProcessState
Whatever a test does to the process (locale, LANGUAGE/LC_*, LOCPATH, the static state of the runtime ...
Write access to the language installation: installing, flushing and registering languages in the data...
Covers the private static databaseRowsOfMigratedModule(): it folds the buffered per-form lng_data row...
call(array $rows, array $final_entries, array $shipped_entries, array $remarks=[])
testAPlainRowOfAnUnrelatedIdentifierIsKeptUnchanged()
A plain row of an identifier that is not a plural message of the shipped state (here the separately s...
testASingleFormLanguageStillFoldsIntoOneRow()
A single-form language (nplurals=1) still folds into one row keyed by its identifier.
testTwoFormRowsFoldIntoOneRowWithTheDefaultFormsValue()
Two buffered form rows fold into one row under the plain identifier, with the default form's (msgstr[...
testRemarksParameterOverridesTheRowsOwnRemarkForAPlainIdentifier()
$remarks (from migratedModuleRemarks()) overrides the remark of the buffered rows,...
testLocalChangeIsNullWhenTheMergedDefaultFormValueMatchesTheShippedOne()
local_change depends on the merged default-form VALUE differing from the shipped default,...
testTheFirstNonNullLocalChangeAndRemarksOfTheFormRowsAreKeptWhenTheValueActuallyChanged()
The first non-null local_change/remarks among the form rows wins once the merged value differs; a lat...
testFormRowsWithNoValueInTheFinalContentAreDroppedEntirely()
A form row whose message has no value in the final content is dropped instead of written with a bogus...
testRemarksParameterOverridesTheMergedRemarkOfAPluralMessage()
testAnEarlierNonNullLocalChangeSurvivesALaterRowsNullOnesWhenTheValueActuallyChanged()
Same, with the local_change-carrying row processed first.
testAnIdentifierNotInRemarksKeepsTheRowsOwnRemark()
An identifier not named in $remarks keeps the rows' own remark.