loadQuestions($departmentId, $laneId, $vehicleTypeId, $config); } public function conditionsFor(int $departmentId, int $laneId, int $vehicleTypeId, array $config): array { return $this->loadConditions($departmentId, $laneId, $vehicleTypeId, null, $config); } public function tasksFor(int $departmentId, int $laneId, int $vehicleTypeId, array $config): array { return $this->loadTasks($departmentId, $laneId, $vehicleTypeId, null, $config); } } it('applies department product rows with lane zero to all lanes in published v2 configs', function (): void { $flow = new SelfservePublishedConfigLaneWildcardHarness(); $config = [ 'schema_version' => 2, 'questions' => [ ['id' => 1, 'department' => 6, 'lane' => 0, 'product' => 1, 'question' => 'Wildcard question'], ['id' => 2, 'department' => 6, 'lane' => 99, 'product' => 1, 'question' => 'Other lane question'], ], 'conditions' => [ ['id' => 11, 'department' => 6, 'lane' => 0, 'product' => 1, 'machine_type_id' => null, 'expression' => ['type' => 'predicate', 'subject_type' => 'question', 'subject_id' => 1, 'operator' => 'IS_TRUE']], ['id' => 12, 'department' => 6, 'lane' => 99, 'product' => 1, 'machine_type_id' => null, 'expression' => ['type' => 'predicate', 'subject_type' => 'question', 'subject_id' => 2, 'operator' => 'IS_TRUE']], ], 'tasks' => [ ['id' => 21, 'department' => 6, 'lane' => 0, 'product' => 1, 'machine_type_id' => null, 'task' => 'Wildcard task', 'services' => ['MACHINE'], 'buttons' => [], 'gate_type' => 'ALWAYS', 'gate_ref_id' => null], ['id' => 22, 'department' => 6, 'lane' => 99, 'product' => 1, 'machine_type_id' => null, 'task' => 'Other lane task', 'services' => ['MACHINE'], 'buttons' => [], 'gate_type' => 'ALWAYS', 'gate_ref_id' => null], ], ]; expect(array_column($flow->questionsFor(6, 12, 1, $config), 'id'))->toBe([1]); expect(array_column($flow->conditionsFor(6, 12, 1, $config), 'id'))->toBe([11]); expect(array_column($flow->tasksFor(6, 12, 1, $config), 'id'))->toBe([21]); });