菜谱项目

AddressTest.php 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace Faker\Provider\en_IN;
  3. use Faker\Generator;
  4. use Faker\Provider\en_IN\Address;
  5. class AddressTest extends \PHPUnit_Framework_TestCase
  6. {
  7. /**
  8. * @var Faker\Generator
  9. */
  10. private $faker;
  11. public function setUp()
  12. {
  13. $faker = new Generator();
  14. $faker->addProvider(new Address($faker));
  15. $this->faker = $faker;
  16. }
  17. public function testCity()
  18. {
  19. $city = $this->faker->city();
  20. $this->assertNotEmpty($city);
  21. $this->assertInternalType('string', $city);
  22. $this->assertRegExp('/[A-Z][a-z]+/', $city);
  23. }
  24. public function testCountry()
  25. {
  26. $country = $this->faker->country();
  27. $this->assertNotEmpty($country);
  28. $this->assertInternalType('string', $country);
  29. $this->assertRegExp('/[A-Z][a-z]+/', $country);
  30. }
  31. public function testLocalityName()
  32. {
  33. $localityName = $this->faker->localityName();
  34. $this->assertNotEmpty($localityName);
  35. $this->assertInternalType('string', $localityName);
  36. $this->assertRegExp('/[A-Z][a-z]+/', $localityName);
  37. }
  38. public function testAreaSuffix()
  39. {
  40. $areaSuffix = $this->faker->areaSuffix();
  41. $this->assertNotEmpty($areaSuffix);
  42. $this->assertInternalType('string', $areaSuffix);
  43. $this->assertRegExp('/[A-Z][a-z]+/', $areaSuffix);
  44. }
  45. }
  46. ?>