forked from fa/breadcrumb-the-shire
Simplifies the tenant Visibility tab to match the tenant-only appearance
model established by the previous commits:
- primary_color: now required. Removed the "No brand color / Use system
default (no brand accent)" toggle — every tenant carries a concrete
primary color. Legacy NULL rows render the neutral app default (#2fa4a4)
in the color picker and are converted to that explicit hex on save.
- default_theme: the select no longer offers a "Use system default" empty
option. Legacy NULL rows resolve to 'light' at render time; saves always
persist a valid theme via SettingsAppGateway::normalizeTheme().
- allow_user_theme: replaced the tri-state "Use system default (allowed) /
Force allow / Force disallow" select with a single boolean switch
("Users may choose their own theme"). Legacy NULL rows load as checked.
Saves persist 0/1 explicitly.
TenantService: sanitize no longer reads primary_color_use_default or
allow_user_theme_mode; it validates primary_color as a required hex and
treats allow_user_theme as a plain boolean. Both create and update paths
write concrete values only — no more NULL writes for these three fields.
DirectorySettingsGateway gains a normalizeTheme() delegate so TenantService
can route through the same gateway it uses for isAllowedTheme().
Removed now-unused app-color-default-toggle JS component + its runtime
registration + its architecture-test entry. i18n cleanup: "No brand
color", "Use system default (no brand accent)", "When enabled the tenant
renders without a brand accent color.", "Use system default (light)",
"Use system default (allowed)", "Force allow user theme", "Force disallow
user theme", "User theme policy is invalid" all removed. New copy: "Users
may choose their own theme" + helper text, plus a tightened tab blockquote.
Tests: TenantServiceTest validInput() updated to send concrete values;
settingsGateway mock gets normalizeTheme() + isAllowedTheme() defaults.
All 1985 tests pass; PHPStan level 5 clean; QG-006 clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tests
Ziel
Die Tests sind nach Schutzwirkung organisiert, nicht nur nach technischer Ebene. Wichtige Architektur- und Security-Invarianten sollen schnell gezielt laufen koennen, ohne dass jede Aenderung immer die komplette Suite im Kopf behalten muss.
PHPUnit-Suiten
CoreCore: gesamte Test-Suite.Unit: kleine verhaltensorientierte Unit-Tests ohne breites Orchestrierungs-Setup.Service: Business-Logik, Policies, Gateways und Orchestrierungs-Tests untertests/Service/.Repository: Query- und Repository-Tests untertests/Repository/.Domain: fachliche Taxonomie- und Domain-Tests untertests/Domain/.Architecture: alle Architektur-Contracts untertests/Architecture/.ArchitectureCore: Core-Boundaries, Module-/Repository-Contracts, Taxonomie- und Sync-Contracts.ArchitectureSecurity: CSRF, PRG, File-Storage, Crypto, Logging sowie AuthZ-nahe Contracts.ArchitectureUI: UI-Contracts fuer Listen, Detailseiten, Runtime-Komponenten und A11y.ArchitectureModules: modulbezogene Struktur- und Isolations-Contracts.ArchitectureMeta: Agent-/Skill-/Meta-Contracts fuer das Repository-Setup.
Regeln fuer neue Architecture-Tests
- Nur stabile Invarianten testen, keine einmaligen Migrationsdetails.
- Guards oder Risiken explizit abdecken, zum Beispiel
GR-CORE-*,GR-SEC-*,GR-TEST-*. - Keine Duplikate neben bereits breiten Contracts anlegen.
- String-Assertions nur verwenden, wenn kein robusterer Contract moeglich ist.
- Monolithische Sammeltests vermeiden; lieber kleine thematische Contracts.
Delete vs. Refactor vs. Keep
keep: testet einen echten plattformweiten Contract oder Security-Guard.refactor: Schutz ist wichtig, aber der Test ist zu datei-, markup- oder implementation-detailnah.delete: dupliziert bestehende Schutzwirkung oder prueft nur historische Altlasten.
Regeln fuer neue Service-Tests
- Services auf Guards, Orchestrierung, Normalisierung, Fehlerpfade und Seiteneffekte testen.
- Keine eigenen Tests fuer reine
find/list/get/set-Delegation ohne zusaetzliche Regel. - Thin Wrapper auf gemeinsame Primitive zentral testen, nicht pro Gateway erneut.
- Mockability-, Reflection- und Interface-Existenz-Tests ohne Risiko-Schutz vermeiden.
- Kleine Normalisierungs-Matrizen mit DataProvidern oder zusammengezogenen Contract-Dateien verdichten.
Typische Low-Value-Muster
- Gateway-Test prueft nur
encrypt/decrypterneut, obwohl das Basisverhalten schon zentral abgesichert ist. - Test bestaetigt nur, dass ein Service eins zu eins an Repository oder Gateway weiterreicht.
- Test prueft nur Methodensignatur, Reflection oder dass eine Klasse mockbar ist.
- Mehrere Minidateien decken denselben Settings-/Fallback-Mechanismus mit identischem Mock-Muster ab.
Naechste Audit-Kandidaten
- methodenweiser Low-value-Pass in
tests/Service/User/UserAccountServiceTest.php - methodenweiser Low-value-Pass in
tests/Service/Org/DepartmentServiceTest.php - methodenweiser Low-value-Pass in
tests/Service/Access/RoleServiceTest.php - verbleibende kleine Settings-Gateway-Tests auf weitere Verdichtung pruefen