chore: update documentation

This commit is contained in:
Björn Fromme
2025-10-18 17:17:49 +02:00
parent 0f8fed605c
commit b894bbf5e6
3 changed files with 23 additions and 816 deletions
+23 -2
View File
@@ -122,6 +122,8 @@ Critical for correct pricing and auto-reassignment:
- **Auto-reassignment**: Maintains insurance type when price tier changes
- **Age constraints**: Absolute age (at travel date) vs birth year
- **Hydration**: `TravelDataService::hydrateInsurancePackageRelationships()` rebuilds package relationships after cache deserialization
- **ID Type**: Insurance IDs are strings (not integers) - ensure all test fixtures use string IDs
- **Mutability**: Insurances are always readonly in edit mode (API limitation) - see `InsuranceMutabilityCondition`
### Transportation Services
- **Unified pickup field**: Single field for both directions (BPN API limitation)
@@ -190,6 +192,13 @@ Critical for correct pricing and auto-reassignment:
- Ensure dependencies declared correctly
- Check sync pattern: only sync fields in original submission
### Writing Tests
- **Insurance IDs**: Always use strings, not integers (e.g., `'100'` not `100`)
- **Room properties**: Use `$label` property, not `$name`
- **Participant names**: Index 0 expects "Anmelder:in", others expect "Teilnehmer:in N" (1-based)
- **Mock dependencies**: Ensure all constructor dependencies have mocks (especially new ones like `InsuranceLoader`, `InsuranceTypeFilterService`)
- **Insurance mutability**: In edit mode, insurances are always readonly (API limitation)
## File Locations
### Key Design Patterns
@@ -295,12 +304,21 @@ Edit mode session requires proper cleanup to prevent dirty state persistence:
## Testing
```bash
./vendor/bin/phpunit # All tests
./vendor/bin/phpunit # All tests (182 tests, 465 assertions)
./vendor/bin/phpunit tests/Service/ # Service layer
./vendor/bin/phpunit tests/BusProNet/ # API integration
./vendor/bin/php-cs-fixer fix # Code style (Symfony ruleset)
./vendor/bin/phpunit tests/Form/ # Form processing and field handlers
/opt/homebrew/bin/php-cs-fixer fix --rules=@Symfony # Code style (Symfony ruleset)
```
**Test Coverage Areas:**
- BusProNet data loaders and processors
- XML parsers (travels, hotels, bookings, insurances)
- Form DTOs and field handlers
- Service layer (pricing, insurance matching, room assignment)
- Conditional field system
- Utility classes
## Development Environment
```bash
@@ -314,16 +332,19 @@ ddev exec "php -r 'opcache_reset()';" # Clear opcache after code cha
## Important Notes
- **Room prices are per person**
- **Room model uses `$label` property** (not `$name`) - ensure test fixtures use correct property
- **Zero prices display without suffix** (e.g., "Vollpension" not "Vollpension (€0,00)")
- **All services sorted by price** (cheapest first) via `SortByPriceTrait`
- **Field sync pattern critical**: Only sync fields in original submission to avoid "extra fields" errors
- **Insurance handler requires mode awareness**: Skips processing in edit mode (API doesn't return insurance data)
- **Insurance IDs are strings**: All insurance IDs must be strings, not integers (type safety)
- **Clear opcache after code changes** affecting hydration or serialization
- **HTMX targeting consistency**: All swaps target `#main-content` with `innerHTML`, sidebar via OOB swap
- **Validation pattern**: Both create and edit flows use validation-only forms that wrap card UI for standard Symfony form handling
- **Card error indicators**: `ParticipantValidationTrait::extractParticipantErrorIndices()` parses form errors to highlight invalid participant cards
- **Edit mode service availability**: Services with `available <= 0` remain visible and editable for participants who already have them (prevents fingerprint false positives)
- **Session cleanup on exit**: All exit paths from edit mode (save, discard, cancel) properly clear session to reset dirty state
- **Participant naming convention**: Index 0 is "Anmelder:in", others are "Teilnehmer:in N" (1-based, not 0-based)
## References