value)->toBe($expected); })->with([ 'check digit from remainder' => ['0737546-2', '0737546-2'], 'remainder 0 gives check digit 0' => ['1572860-0', '1572860-0'], 'surrounding whitespace' => [' 0737546-2 ', '0737546-2'], 'old six-digit form is padded' => ['737546-2', '0737546-2'], ]); it('rejects an invalid business id', function (string $input) { new BusinessId($input); })->throws(InvalidBusinessId::class)->with([ 'wrong check digit' => ['0737546-3'], 'remainder 1 has no valid check digit' => ['0000006-5'], 'missing hyphen' => ['07375462'], 'letters' => ['07375a6-2'], 'too many digits' => ['10737546-2'], 'empty' => [''], ]); it('compares by value', function () { expect((new BusinessId('737546-2'))->equals(new BusinessId('0737546-2')))->toBeTrue() ->and((new BusinessId('0737546-2'))->equals(new BusinessId('1572860-0')))->toBeFalse(); });