Merge pull request #166 from copenhagentruckwash/fix-pathoutcomespayload-argument-type-error
Accept null confirmation rows in pathOutcomesPayload
This commit is contained in:
@@ -4319,8 +4319,10 @@ class selfserve_studio_graph
|
||||
int $terminalPathCount,
|
||||
array $questionIds,
|
||||
array $progress = [],
|
||||
array $confirmationRows = []
|
||||
?array $confirmationRows = null
|
||||
): array {
|
||||
$confirmationRows = $confirmationRows ?? [];
|
||||
|
||||
usort($outcomes, static fn(array $left, array $right): int => ((int)($right['path_count'] ?? 0) <=> (int)($left['path_count'] ?? 0))
|
||||
?: strcmp((string)($left['summary'] ?? ''), (string)($right['summary'] ?? '')));
|
||||
foreach ($outcomes as $index => &$outcome) {
|
||||
|
||||
@@ -1265,6 +1265,29 @@ it('marks projected path confirmations confirmed or stale by stable signatures',
|
||||
->and($changed['summary']['confirmations']['stale'])->toBe(1);
|
||||
});
|
||||
|
||||
it('treats null path confirmation rows as an empty confirmation set', function (): void {
|
||||
$service = selfserve_studio_graph_without_constructor();
|
||||
$method = new ReflectionMethod(selfserve_studio_graph::class, 'pathOutcomesPayload');
|
||||
|
||||
$payload = $method->invoke(
|
||||
$service,
|
||||
['department_id' => 6, 'lane_id' => 7],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
false,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
[],
|
||||
[],
|
||||
null
|
||||
);
|
||||
|
||||
expect($payload['summary']['confirmations']['total'])->toBe(0)
|
||||
->and($payload['confirmations']['removed'])->toBe([]);
|
||||
});
|
||||
|
||||
it('truncates path outcome projection when the state cap is reached', function (): void {
|
||||
$service = selfserve_studio_graph_without_constructor();
|
||||
$simulate = function (array $overrides): array {
|
||||
|
||||
Reference in New Issue
Block a user