1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<?php
namespace Faker\Test\Provider\de_AT;
use Faker\Provider\de_AT\PhoneNumber;
use Faker\Test\TestCase;
/**
* @group legacy
*/
final class PhoneNumberTest extends TestCase
{
public function testPhoneNumberFormat()
{
$number = $this->faker->phoneNumber;
self::assertMatchesRegularExpression('/^06\d{2} \d{7}|\+43 \d{4} \d{4}(-\d{2})?$/', $number);
}
public function testE164PhoneNumberFormat()
{
for ($i = 0; $i < 10; ++$i) {
$number = $this->faker->e164PhoneNumber();
self::assertMatchesRegularExpression('/^\+43\d{1,13}$/', $number);
}
}
protected function getProviders(): iterable
{
yield new PhoneNumber($this->faker);
}
}
|