菜谱项目

PhoneNumberTest.php 853B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Faker\Test\Provider\ro_RO;
  3. use Faker\Generator;
  4. use Faker\Provider\ro_RO\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 testPhoneNumberReturnsNormalPhoneNumber()
  14. {
  15. $this->assertRegExp('/^0(?:[23][13-7]|7\d)\d{7}$/', $this->faker->phoneNumber());
  16. }
  17. public function testTollFreePhoneNumberReturnsTollFreePhoneNumber()
  18. {
  19. $this->assertRegExp('/^08(?:0[01267]|70)\d{6}$/', $this->faker->tollFreePhoneNumber());
  20. }
  21. public function testPremiumRatePhoneNumberReturnsPremiumRatePhoneNumber()
  22. {
  23. $this->assertRegExp('/^090[036]\d{6}$/', $this->faker->premiumRatePhoneNumber());
  24. }
  25. }