Skip to content

Commit 9c57951

Browse files
authored
Merge pull request #6518 from ConductionNL/quality/build-tenders-run-on-the-tender-case-type-5
feat(dossiq): build tenders-run-on-the-tender-case-type
2 parents 37c9de1 + 01cc4ce commit 9c57951

6 files changed

Lines changed: 185 additions & 3 deletions

File tree

‎lib/Settings/packages/aanbesteding/package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
"id": "aanbesteding",
33
"title": "Aanbesteding",
44
"summary": "Case type from preparation through publication, bids and evaluation to the award decision.",
5-
"version": "1.8.0",
5+
"version": "1.9.0",
66
"requires": [],
77
"parts": [
88
"case-type",
99
"flows",
10+
"seed",
1011
"examples"
1112
],
1213
"install": "on-request",
13-
"description": "The Aanbesteding case type: a tender from preparation through publication, bids and evaluation to the award decision, with its statuses, roles and flow: evaluation starts after the closing date and the award becomes final once the standstill term has ended (the case's opschortendeTermijnEinde). Category 'Inkoop en leveranciers', which is what the case page's bids card and tab gate on. Installed on request: POST /api/packages/aanbesteding/install, or occ dossiq:package:install aanbesteding. Ships an example case in flight (`examples/`), written with the package, its dates relative to the install day."
14+
"description": "The Aanbesteding case type: a tender from preparation through publication, bids and evaluation to the award decision, with its statuses, roles and flow: evaluation starts after the closing date and the award becomes final once the standstill term has ended (the case's opschortendeTermijnEinde). Category 'Inkoop en leveranciers', which is what the case page's bids card and tab gate on. Installed on request: POST /api/packages/aanbesteding/install, or occ dossiq:package:install aanbesteding. Seeds the award and refusal decision types and the 20-day standstill term (Aw 2012 art. 2.127, calendar days) (`seed/`). Ships an example case in flight (`examples/`), written with the package, its dates relative to the install day."
1415
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"schema": "decision_type_schema",
3+
"match": [
4+
"name",
5+
"caseType"
6+
],
7+
"rows": [
8+
{
9+
"id": "5f4e51d5-288c-52e8-b82d-cbd4272b08a3",
10+
"name": "Gunningsbeslissing",
11+
"description": "Het besluit aan welke inschrijver de opdracht wordt gegund, met de motivering per inschrijver. Het opent de opschortende termijn; de gunning is pas definitief als die is verstreken.",
12+
"caseType": "d2b26387-ec33-533a-bd75-4ded3719a932",
13+
"caseTypes": [
14+
"d2b26387-ec33-533a-bd75-4ded3719a932"
15+
],
16+
"isDraft": false,
17+
"publicationRequired": false
18+
},
19+
{
20+
"id": "f299a4e4-9d38-5dff-830f-db40eafa97da",
21+
"name": "Afwijzingsbeslissing",
22+
"description": "Het besluit dat een inschrijving niet wordt gegund of ongeldig is, met de redenen en de relevante kenmerken van de winnende inschrijving.",
23+
"caseType": "d2b26387-ec33-533a-bd75-4ded3719a932",
24+
"caseTypes": [
25+
"d2b26387-ec33-533a-bd75-4ded3719a932"
26+
],
27+
"isDraft": false,
28+
"publicationRequired": false
29+
}
30+
]
31+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"schema": "termijn_definitie_schema",
3+
"match": [
4+
"caseType",
5+
"legalBasis"
6+
],
7+
"rows": [
8+
{
9+
"id": "0b94015f-42f0-56b8-9fd8-f9f7fecae070",
10+
"caseType": "aanbesteding",
11+
"legalBasis": "Aw 2012 art. 2.127",
12+
"standardDurationDays": 20,
13+
"countingMode": "calendarDays",
14+
"rollToWorkingDay": false,
15+
"kind": "statutory",
16+
"validFrom": "2026-01-01"
17+
}
18+
]
19+
}

‎openspec/changes/tenders-run-on-the-tender-case-type/tasks.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [x] 1.1 Schemas `bid`, `tenderQuestion`, `evaluation`, `scoringFormula` per REQ-TND-004, REQ-TND-007, REQ-EVA-001 and REQ-EVA-003, shipped with the `aanbesteding` package (cross-app schema references, decision 198) or in `lib/Settings/register.d/` if the installer cannot ship schemas yet. Built in `lib/Settings/register.d/88-tender-records.json` (the installer ships no schemas yet): the four schemas with the fields the specs name, declared lifecycles for bid, question and evaluation (a late bid goes from received straight to inadmissible), the three common scoring formulas seeded as records, config keys in `SchemaSlugMap`, register 0.20.97. No award schema: the award is a decision. `tests/Unit/Settings/TenderRecordsSchemasTest.php`.
66
- [x] 1.2 `lib/Settings/packages/aanbesteding/flows/aanbesteding.json`: the flow over Voorbereiding to Gegund, guarded by the closing date and the standstill term. Built with a generic `dateReached` guard (`lib/Service/Transitions/DateReachedGuard.php`) on the case's `sluiting` (only after the day) and `opschortendeTermijnEinde`; the case type declares both and `gunningsdatum`. Filling `opschortendeTermijnEinde` from the 20-day term is task 1.3.
77
- [ ] 1.3 Decision types for award and refusal (REQ-EVA-002); terms for the question deadline and the 20-day standstill (REQ-TND-006, REQ-EVA-005) in the package.
8+
Partly built: the package's `seed/` part ships the decision types Gunningsbeslissing and Afwijzingsbeslissing on the tender case type and the 20-day standstill term (Aw 2012 art. 2.127, calendar days, bound to the case type slug); package 1.9.0; `tests/Unit/Settings/AanbestedingPackageSeedTest.php`. Left: the question-deadline term, which is a date each tender sets in its own timeline rather than a fixed duration, so it needs a decision on how it is modelled.
89
- [ ] 1.4 `examples/`: one tender in evaluation with two lots and three bids; bump the package version.
910
- [ ] 1.5 `tests/integration/packages/aanbesteding.postman_collection.json`: install, register a bid, refuse a late bid, score, award.
1011

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?php
2+
3+
/**
4+
* The aanbesteding package seeds its decision types and its standstill term
5+
*
6+
* An award is a decision, and a refusal of a bid is one too; both are decision
7+
* types of the tender case type. The award only becomes final once the 20-day
8+
* standstill term has ended, so the package also ships that term for the case
9+
* type, counted in calendar days.
10+
*
11+
* @category Test
12+
* @package OCA\Dossiq\Tests\Unit\Settings
13+
*
14+
* @author Conduction Development Team <info@conduction.nl>
15+
* @copyright 2026 Conduction B.V.
16+
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
17+
*
18+
* SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
19+
* SPDX-License-Identifier: EUPL-1.2
20+
*
21+
* @link https://conduction.nl
22+
*
23+
* @spec openspec/changes/tenders-run-on-the-tender-case-type/tasks.md
24+
*/
25+
26+
declare(strict_types=1);
27+
28+
namespace OCA\Dossiq\Tests\Unit\Settings;
29+
30+
use OCA\Dossiq\Service\CaseDefinition\ShippedPackageRules;
31+
use PHPUnit\Framework\TestCase;
32+
33+
class AanbestedingPackageSeedTest extends TestCase {
34+
35+
/**
36+
* The package directory.
37+
*/
38+
private const DIR = __DIR__ . '/../../../lib/Settings/packages/aanbesteding';
39+
40+
/**
41+
* One file of the package, decoded.
42+
*
43+
* @param string $path The path in the package.
44+
*
45+
* @return array<string, mixed>
46+
*/
47+
private static function json(string $path): array {
48+
return json_decode((string)file_get_contents(self::DIR . '/' . $path), true, 512, JSON_THROW_ON_ERROR);
49+
}//end json()
50+
51+
/**
52+
* A schema of the register by key, from the main file or a fragment.
53+
*
54+
* @param string $key The schema key.
55+
*
56+
* @return array<string, mixed>
57+
*/
58+
private static function schema(string $key): array {
59+
$files = array_merge([__DIR__ . '/../../../lib/Settings/dossiq_register.json'], glob(__DIR__ . '/../../../lib/Settings/register.d/*.json'));
60+
foreach ($files as $file) {
61+
$register = json_decode((string)file_get_contents($file), true);
62+
if (isset($register['components']['schemas'][$key]) === true) {
63+
return $register['components']['schemas'][$key];
64+
}
65+
}
66+
67+
return [];
68+
}//end schema()
69+
70+
public function testThePackagePassesTheShippedPackageRulesWithItsSeed(): void {
71+
$files = [];
72+
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(self::DIR, \FilesystemIterator::SKIP_DOTS));
73+
foreach ($iterator as $file) {
74+
$files[substr($file->getPathname(), strlen(self::DIR) + 1)] = (string)file_get_contents($file->getPathname());
75+
}
76+
77+
$result = (new ShippedPackageRules())->check(['id' => 'aanbesteding', 'files' => $files]);
78+
79+
$this->assertSame([], $result['errors']);
80+
$this->assertSame([], $result['warnings']);
81+
$this->assertTrue($result['valid']);
82+
$this->assertContains('seed', $result['manifest']['parts']);
83+
$this->assertSame('1.9.0', $result['manifest']['version']);
84+
}//end testThePackagePassesTheShippedPackageRulesWithItsSeed()
85+
86+
public function testTheAwardAndTheRefusalAreDecisionTypesOfTheTenderCaseType(): void {
87+
$caseType = self::json('case-type.json')['caseType']['id'];
88+
$seed = self::json('seed/10-decision-types.json');
89+
90+
$this->assertSame('decision_type_schema', $seed['schema']);
91+
$this->assertSame(['Gunningsbeslissing', 'Afwijzingsbeslissing'], array_column($seed['rows'], 'name'));
92+
$declared = array_keys(self::schema('decisionType')['properties']);
93+
foreach ($seed['rows'] as $row) {
94+
$this->assertSame($caseType, $row['caseType']);
95+
$this->assertSame([$caseType], $row['caseTypes']);
96+
$this->assertFalse($row['isDraft']);
97+
$this->assertNotSame('', trim($row['description']));
98+
$this->assertSame([], array_diff(array_keys($row), array_merge($declared, ['id'])), 'only declared fields');
99+
}
100+
101+
$this->assertSame(2, count(array_unique(array_column($seed['rows'], 'id'))));
102+
}//end testTheAwardAndTheRefusalAreDecisionTypesOfTheTenderCaseType()
103+
104+
public function testTheStandstillIsTwentyCalendarDaysForTheTenderCaseType(): void {
105+
$seed = self::json('seed/20-standstill-term.json');
106+
$schema = self::schema('deadlineDefinition');
107+
108+
$this->assertSame('termijn_definitie_schema', $seed['schema']);
109+
$this->assertCount(1, $seed['rows']);
110+
$term = $seed['rows'][0];
111+
112+
$this->assertSame(self::json('case-type.json')['caseType']['identifier'], $term['caseType'], 'bound by the case type slug');
113+
$this->assertSame('Aw 2012 art. 2.127', $term['legalBasis']);
114+
$this->assertSame(20, $term['standardDurationDays']);
115+
$this->assertSame('calendarDays', $term['countingMode']);
116+
$this->assertFalse($term['rollToWorkingDay']);
117+
118+
foreach ($schema['required'] as $field) {
119+
$this->assertArrayHasKey($field, $term, "the term carries required $field");
120+
}
121+
122+
$this->assertContains($term['countingMode'], $schema['properties']['countingMode']['enum']);
123+
$this->assertContains($term['kind'], $schema['properties']['kind']['enum']);
124+
$this->assertSame([], array_diff(array_keys($term), array_merge(array_keys($schema['properties']), ['id'])), 'only declared fields');
125+
}//end testTheStandstillIsTwentyCalendarDaysForTheTenderCaseType()
126+
}//end class

‎tests/Unit/Settings/SeedPayloadSchemaConformanceTest.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
namespace OCA\Dossiq\Tests\Unit\Settings;
3333

3434
use OCA\Dossiq\Service\Settings\RegisterFragmentMerger;
35+
use OCA\Dossiq\Service\Settings\SchemaSlugMap;
3536
use PHPUnit\Framework\TestCase;
3637

3738
/**
@@ -71,6 +72,7 @@ class SeedPayloadSchemaConformanceTest extends TestCase {
7172
'propertyDefinitions' => 'propertyDefinition',
7273
'inspectionChecklists' => 'inspectionChecklistTemplate',
7374
'lhsMatrices' => 'lhsMatrix',
75+
'deadlineDefinitions' => 'deadlineDefinition',
7476
];
7577

7678
/**
@@ -235,7 +237,9 @@ public function testPackageSeedRowsOnlyWriteDeclaredProperties(): void {
235237

236238
$collection = null;
237239
foreach (self::COLLECTION_SCHEMA as $key => $slug) {
238-
$settingsKey = strtolower((string)preg_replace('/(?<!^)[A-Z]/', '_$0', $slug)) . '_schema';
240+
// The settings key the installer resolves; most spell their slug,
241+
// some (deadlineDefinition is `termijn_definitie_schema`) do not.
242+
$settingsKey = (SchemaSlugMap::SLUG_TO_CONFIG_KEY[$slug] ?? strtolower((string)preg_replace('/(?<!^)[A-Z]/', '_$0', $slug)) . '_schema');
239243
if ($settingsKey === (string)($data['schema'] ?? '')) {
240244
$collection = $key;
241245
}

0 commit comments

Comments
 (0)