AddressTest.php 1.2 KB

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