Files
portal/app/tests/Unit/Support/PhoneNormalizerTest.php
T
2026-06-18 22:25:23 +03:00

18 lines
575 B
PHP

<?php
declare(strict_types=1);
use App\Support\PhoneNormalizer;
it('normalizes russian phones to +7XXXXXXXXXX', function (string $input, ?string $expected) {
expect(PhoneNormalizer::normalize($input))->toBe($expected);
})->with([
['+7 (915) 123-45-67', '+79151234567'],
['8 915 123 45 67', '+79151234567'],
['9151234567', '+79151234567'],
['7(915)1234567', '+79151234567'],
['123', null],
['+1 202 555 0143', null], // 11 цифр, но начинается не с 7/8
['', null],
]);