U-A/U-B: Prozesskern mit Fachmodulen, versionierten Modellen, eingefrorenem Prozessplan, ProcessRunner (harte/weiche Abhängigkeiten), CasePricing, Loyalty nur im Tester

CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11:
11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002).
Volle Suite vor U-B: 785/785.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-04 14:49:44 +01:00
1 parent 98df5e9e3b
commit 7e22e12cac
80 files changed
+4628 -445

No files matched your search

@@ -0,0 +1,49 @@
<?php
namespace Tests\Support\Process;
use App\Enums\CaseType;
use App\Process\Models\InquiryModel;
use App\Process\Models\Point;
use App\Process\Models\Variant;
/**
* An A1 model with a variant that inserts the address check at AfterGuestIdentified – only in tests.
*/
final class A1WithAddressCheck extends InquiryModel
{
public static function key(): string
{
return 'a1.offer_address';
}
public static function version(): int
{
return 1;
}
public static function label(): string
{
return 'Angebot mit Adressprüfung (Test)';
}
public static function description(): string
{
return 'Test';
}
public static function caseTypes(): array
{
return [CaseType::A1];
}
public static function fixes(): array
{
return ['pre_reservation' => true];
}
public function variants(): array
{
return [Variant::make('standard', 'Standard'), Variant::make('address_check', 'Mit Adressprüfung')->insert(Point::AfterGuestIdentified, 'guest.address_verification')];
}
}
@@ -0,0 +1,77 @@
<?php
namespace Tests\Support\Process;
use App\Enums\ActivityState;
use App\Process\Activity;
use App\Process\CaseContext;
use App\Process\Modules\Dependency;
use App\Process\Modules\Module;
use App\Process\Modules\ModuleDefinition;
use App\Process\Modules\RunsAutomatically;
use App\Process\Modules\StepState;
use App\Process\StepResult;
/**
* The test case of the module criteria (docs/Prozessarchitektur/Architektur/02 §2.1): an external address check is a
* module of its own – own result, own effect (network), own waiting state, own evidence, switchable per channel. Not
* part of the application; it shows that such a module fits at an existing extension point without changing other
* models, and that its waiting does not hold back steps that do not depend on it.
*/
final class AddressVerification extends Module implements RunsAutomatically
{
public static bool $serviceAvailable = true;
public static function key(): string
{
return 'guest.address_verification';
}
public static function definition(): ModuleDefinition
{
return new ModuleDefinition(
label: 'Anschrift extern prüfen',
purpose: 'Prüft die Anschrift bei einem Adressdienst.',
phase: 'P01',
requires: [Dependency::hard('guest.details')],
effects: ['network', 'case_write'],
waits: ['time'],
triggers: ['automation'],
toggle: ModuleDefinition::TOGGLE_OPTIONAL,
modes: ['automatic'],
points: ['after_guest_identified'],
);
}
public function activities(CaseContext $case): array
{
$state = $this->state($case);
return [new Activity('address_check', 'Anschrift extern prüfen', $state === StepState::Done ? ActivityState::Done : ActivityState::Waiting, self::$serviceAvailable ? null : 'Adressdienst nicht erreichbar – neuer Versuch später')];
}
public function state(CaseContext $case): ?StepState
{
return self::$serviceAvailable ? StepState::Done : StepState::Waiting;
}
public function due(CaseContext $case): bool
{
return ! self::$serviceAvailable;
}
public function blockers(CaseContext $case): array
{
return [];
}
public function run(CaseContext $case): StepResult
{
return StepResult::blocked(['Adressdienst nicht erreichbar.']);
}
public function isOutward(): bool
{
return false;
}
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace Tests\Support\Process;
use App\Enums\CaseType;
use App\Enums\IntakeKind;
use App\Process\Models\Point;
use App\Process\Models\ProcessModel;
use App\Process\Models\Responsibilities;
use App\Process\Models\Step;
use App\Process\Models\Variant;
/**
* A model of the four fake modules for the runner tests, with one extension point.
*/
final class FakeModel extends ProcessModel
{
public static function key(): string
{
return 'test.model';
}
public static function version(): int
{
return 1;
}
public static function label(): string
{
return 'Testmodell';
}
public static function description(): string
{
return 'Testmodell';
}
public static function caseTypes(): array
{
return [CaseType::A1];
}
public static function intakes(): array
{
return [IntakeKind::Inquiry];
}
public static function responsibilities(): Responsibilities
{
return Responsibilities::of([]);
}
public function steps(): array
{
return [Step::module('test.a'), Step::module('test.b'), Step::point(Point::BeforePriceFixing), Step::module('test.c')];
}
public function variants(): array
{
return [Variant::make('standard', 'Standard'), Variant::make('extra', 'Mit D')->insert(Point::BeforePriceFixing, 'test.d')];
}
}
+101
View File
@@ -0,0 +1,101 @@
<?php
namespace Tests\Support\Process;
use App\Enums\ActivityState;
use App\Process\Activity;
use App\Process\CaseContext;
use App\Process\Modules\Dependency;
use App\Process\Modules\ModuleDefinition;
use App\Process\Modules\ProcessModule;
use App\Process\Modules\RunsAutomatically;
use App\Process\Modules\StepState;
use App\Process\StepResult;
use RuntimeException;
/**
* A scriptable module for the runner tests: its state, dependencies and what its run does come from a shared script,
* so the tests can model waiting, failing and state changes during a round. Subclasses only give the key.
*/
abstract class FakeModule implements ProcessModule, RunsAutomatically
{
/**
* @var array<string, array{state?: StepState, due?: bool, requires?: list<Dependency>, run?: callable(): ?StepResult, outward?: bool, applies?: bool}>
*/
public static array $script = [];
/** @var list<string> */
public static array $runs = [];
public static function reset(): void
{
self::$script = [];
self::$runs = [];
}
public static function version(): int
{
return 1;
}
public static function definition(): ModuleDefinition
{
return new ModuleDefinition(
label: 'Testschritt '.static::key(),
purpose: 'Test',
phase: 'P01',
requires: self::$script[static::key()]['requires'] ?? [],
triggers: ['automation', 'test'],
modes: ['automatic'],
);
}
public function applies(CaseContext $case): bool
{
return array_key_exists(static::key(), self::$script) && (self::$script[static::key()]['applies'] ?? true);
}
public function activities(CaseContext $case): array
{
$state = $this->state($case) ?? StepState::Open;
return [new Activity(static::key(), static::key(), ActivityState::from($state->value))];
}
public function state(CaseContext $case): ?StepState
{
return self::$script[static::key()]['state'] ?? StepState::Open;
}
public function due(CaseContext $case): bool
{
return self::$script[static::key()]['due'] ?? ($this->state($case) === StepState::Open);
}
public function blockers(CaseContext $case): array
{
return [];
}
public function run(CaseContext $case): StepResult
{
self::$runs[] = static::key();
$run = self::$script[static::key()]['run'] ?? null;
$result = $run === null ? null : $run();
if ($result === null) {
self::$script[static::key()]['state'] = StepState::Done;
}
return $result ?? StepResult::ran();
}
public function isOutward(): bool
{
return self::$script[static::key()]['outward'] ?? false;
}
public static function fail(): never
{
throw new RuntimeException('Testfehler');
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Tests\Support\Process;
final class FakeModuleA extends FakeModule
{
public static function key(): string
{
return 'test.a';
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Tests\Support\Process;
final class FakeModuleB extends FakeModule
{
public static function key(): string
{
return 'test.b';
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Tests\Support\Process;
final class FakeModuleC extends FakeModule
{
public static function key(): string
{
return 'test.c';
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Tests\Support\Process;
final class FakeModuleD extends FakeModule
{
public static function key(): string
{
return 'test.d';
}
}