create(); $this->assertSame('failed', $attempt->outcome); $this->assertNotEmpty($attempt->exception_class); $this->assertNotEmpty($attempt->exception_message); } public function test_failure_relation_resolves_to_the_parent(): void { $failure = FormSubmissionActionFailure::factory()->create(); $attempt = FormSubmissionActionFailureRetryAttempt::factory() ->for($failure, 'failure') ->create(); $this->assertSame((string) $failure->id, (string) $attempt->failure->id); } public function test_attempted_by_relation_resolves_to_the_user(): void { $user = User::factory()->create(); $attempt = FormSubmissionActionFailureRetryAttempt::factory() ->state(['attempted_by_user_id' => $user->id]) ->create(); $this->assertSame((string) $user->id, (string) $attempt->attemptedBy->id); } public function test_succeeded_state_produces_null_exception_fields(): void { $attempt = FormSubmissionActionFailureRetryAttempt::factory()->succeeded()->create(); $this->assertSame('succeeded', $attempt->outcome); $this->assertNull($attempt->exception_class); $this->assertNull($attempt->exception_message); } public function test_attempted_at_is_cast_to_datetime(): void { $attempt = FormSubmissionActionFailureRetryAttempt::factory()->create(); $this->assertInstanceOf(\Illuminate\Support\Carbon::class, $attempt->attempted_at); } }