菜谱项目

PhoneNumberTest.php 733B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Faker\Test\Provider\pt_PT;
  3. use Faker\Generator;
  4. use Faker\Provider\pt_PT\PhoneNumber;
  5. class PhoneNumberTest extends \PHPUnit_Framework_TestCase
  6. {
  7. public function setUp()
  8. {
  9. $faker = new Generator();
  10. $faker->addProvider(new PhoneNumber($faker));
  11. $this->faker = $faker;
  12. }
  13. public function testPhoneNumberReturnsPhoneNumberWithOrWithoutPrefix()
  14. {
  15. $this->assertRegExp('/^(9[1,2,3,6][0-9]{7})|(2[0-9]{8})|(\+351 [2][0-9]{8})|(\+351 9[1,2,3,6][0-9]{7})/', $this->faker->phoneNumber());
  16. }
  17. public function testMobileNumberReturnsMobileNumberWithOrWithoutPrefix()
  18. {
  19. $this->assertRegExp('/^(9[1,2,3,6][0-9]{7})/', $this->faker->mobileNumber());
  20. }
  21. }