test: expose random capital city metadata
This commit is contained in:
@@ -158,11 +158,10 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void
|
||||
$setup['randomFoundingCandidateCityIds'],
|
||||
'randomFoundingCandidateCityIds',
|
||||
);
|
||||
if ($candidateCityIds === []) {
|
||||
throw new \InvalidArgumentException('randomFoundingCandidateCityIds must not be empty');
|
||||
}
|
||||
$db->update('city', ['level' => 4], '1 = 1');
|
||||
$db->update('city', ['level' => 5], 'city IN %li', $candidateCityIds);
|
||||
if ($candidateCityIds !== []) {
|
||||
$db->update('city', ['level' => 5], 'city IN %li', $candidateCityIds);
|
||||
}
|
||||
}
|
||||
|
||||
if (($setup['isolateWorld'] ?? false) === true) {
|
||||
@@ -190,6 +189,8 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void
|
||||
'front' => 0,
|
||||
'state' => 0,
|
||||
'term' => 0,
|
||||
'conflict' => '{}',
|
||||
'officer_set' => 0,
|
||||
], '1 = 1');
|
||||
}
|
||||
|
||||
@@ -300,7 +301,14 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void
|
||||
'term' => 'term',
|
||||
'trust' => 'trust',
|
||||
'trade' => 'trade',
|
||||
'officerSet' => 'officer_set',
|
||||
]);
|
||||
if (array_key_exists('conflict', $row)) {
|
||||
if (!is_array($row['conflict'])) {
|
||||
throw new \InvalidArgumentException('setup.cities.conflict must be an object');
|
||||
}
|
||||
$patch['conflict'] = Json::encode($row['conflict']);
|
||||
}
|
||||
if ($patch !== []) {
|
||||
$db->update('city', $patch, 'city = %i', $row['id']);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,10 @@ function comparisonTurnStateSnapshot(array $request): array
|
||||
'term' => 'term',
|
||||
'trust' => 'trust',
|
||||
'trade' => 'trade',
|
||||
'conflict' => 'conflict',
|
||||
'officerSet' => 'officer_set',
|
||||
],
|
||||
['conflict'],
|
||||
),
|
||||
comparisonRowsById('city', 'city', $cityIds),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user