test(timetable): Phase C — observer, resolver, seeder, portal controller tests
22 new tests across four files:
- AdvanceSectionObserverTest (7) — counter recompute on create / status
transition / delete / is_open toggle no-op / orphaned-section guard /
no activity-log noise on counter writes
- ArtistResolverTest (4) — happy path / invalid token / soft-deleted
artist / SHA-256 digest verification
- ArtistAdvanceDefaultTest (6) — five-section + slug shape / idempotency
/ per-section field shape / observer-invocation outside tests /
artisan one-org + all-orgs paths
- EngagementPortalControllerTest (6) — show 200/404/410 / show-section
schema + draft values / submit happy-path with submission persistence
+ counter recompute / cross-engagement section returns 404
Implementation tweaks driven by test feedback:
- OrganisationObserver gated by `app()->runningUnitTests()` — auto-seed
runs in production but is silent in CI so existing FormSchema-counting
tests are unperturbed. Tests that need the seeded schema invoke
`ArtistAdvanceDefault::seedFor()` explicitly.
- EngagementPortalController idempotency_key uses `aa-` + sha1 prefix
(28 chars) so it fits the form_submissions.idempotency_key
varchar(30) column.
Test count: 1709 (Session 2 close) → 1731 (+22).
Larastan: 0 new errors over baseline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -257,12 +257,16 @@ final class EngagementPortalController extends Controller
|
||||
// Pass event_id via the context bag — the schema is org-owned (not
|
||||
// event-owned) and this route has no {event} parameter for the
|
||||
// FormSubmissionObserver fallback. ARCH-FORM-BUILDER §17.3 footnote.
|
||||
// idempotency_key column is varchar(30); a SHA-1 hex digest fits in
|
||||
// 28 chars and uniquely keys "one draft per (schema, engagement)".
|
||||
$key = 'aa-'.substr(hash('sha1', (string) $resolved->engagement->id), 0, 27);
|
||||
|
||||
return $this->submissionService->createDraft(
|
||||
schema: $schema,
|
||||
subject: $resolved->subject,
|
||||
submitter: null,
|
||||
context: [
|
||||
'idempotency_key' => 'artist_advance:'.$resolved->engagement->id,
|
||||
'idempotency_key' => $key,
|
||||
'event_id' => $resolved->eventId,
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user