name)->toBe('Europe/Paris') ->and((string) $tz)->toBe('Europe/Paris') ->and($tz->toDateTimeZone())->toBeInstanceOf(\DateTimeZone::class) ->and($tz->toDateTimeZone()->getName())->toBe('Europe/Paris'); }); it('creates default UTC timezone', function (): void { // GIVEN $tz = AppTimezone::utc(); // THEN expect($tz->name)->toBe('UTC') ->and((string) $tz)->toBe('UTC'); }); it('rejects invalid timezone names', function (string $invalid): void { // GIVEN & WHEN & THEN expect(fn () => new AppTimezone($invalid)) ->toThrow(\InvalidArgumentException::class); })->with([ '', ' ', 'Invalid/Timezone_Name', 'Moon/Base', ]); it('handles equality properly', function (): void { // GIVEN $tz1 = new AppTimezone('UTC'); $tz2 = AppTimezone::utc(); $tz3 = new AppTimezone('Europe/Paris'); // THEN expect($tz1->equals($tz2))->toBeTrue() ->and($tz1->equals($tz3))->toBeFalse() ->and($tz1->equals('UTC'))->toBeFalse(); }); });