123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace Faker\Test\Provider;
- use Faker\Generator;
- use Faker\Calculator\Luhn;
- use Faker\Provider\PhoneNumber;
- use PHPUnit\Framework\TestCase;
- class PhoneNumberTest extends TestCase
- {
- /**
- * @var Generator
- */
- private $faker;
- public function setUp()
- {
- $faker = new Generator();
- $faker->addProvider(new PhoneNumber($faker));
- $this->faker = $faker;
- }
- public function testPhoneNumberFormat()
- {
- $number = $this->faker->e164PhoneNumber();
- $this->assertRegExp('/^\+[0-9]{11,}$/', $number);
- }
- public function testImeiReturnsValidNumber()
- {
- $imei = $this->faker->imei();
- $this->assertTrue(Luhn::isValid($imei));
- }
- }
|