You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
716B

  1. <?php
  2. namespace Faker\Test\Provider;
  3. use Faker\Generator;
  4. use Faker\Calculator\Luhn;
  5. use Faker\Provider\PhoneNumber;
  6. class PhoneNumberTest extends \PHPUnit_Framework_TestCase
  7. {
  8. /**
  9. * @var Generator
  10. */
  11. private $faker;
  12. public function setUp()
  13. {
  14. $faker = new Generator();
  15. $faker->addProvider(new PhoneNumber($faker));
  16. $this->faker = $faker;
  17. }
  18. public function testPhoneNumberFormat()
  19. {
  20. $number = $this->faker->e164PhoneNumber();
  21. $this->assertRegExp('/^\+[0-9]{11,}$/', $number);
  22. }
  23. public function testImeiReturnsValidNumber()
  24. {
  25. $imei = $this->faker->imei();
  26. $this->assertTrue(Luhn::isValid($imei));
  27. }
  28. }