create([ 'date' => '2026-05-01', 'label' => 'Old Label', 'repeatable' => false, 'repeat_frequency' => RepeatFrequency::WEEKLY, 'auto_updated' => true, ]); $action = new UpdatePickupException(); $input = new UpdatePickupExceptionInput( pickupException: $pickupException, date: '2026-05-08', label: 'New Label', repeatable: true, repeat_frequency: RepeatFrequency::YEARLY, ); // WHEN $updated = $action($input); // THEN expect($updated->id)->toBe($pickupException->id) ->and($updated->date->format('Y-m-d'))->toBe('2026-05-08') ->and($updated->label)->toBe('New Label') ->and($updated->repeatable)->toBeTrue() ->and($updated->repeat_frequency)->toBe(RepeatFrequency::YEARLY) ->and($updated->auto_updated)->toBeFalse(); $fresh = PickupException::query()->find($pickupException->id); expect($fresh)->not->toBeNull() ->and($fresh?->label)->toBe('New Label') ->and($fresh?->auto_updated)->toBeFalse(); }); test('it throws when an invalid input is passed', function () { // GIVEN $action = new UpdatePickupException(); $invalidInput = new class () implements ActionInput { }; /** @var \Closure(\App\Contracts\ActionInput): mixed $callable */ $callable = \Closure::fromCallable($action); // WHEN & THEN expect(fn () => $callable($invalidInput))->toThrow(\InvalidArgumentException::class); }); });