菜谱项目

AddressTest.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Faker\Provider\en_AU;
  3. use Faker\Generator;
  4. use Faker\Provider\en_AU\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 testCityPrefix()
  18. {
  19. $cityPrefix = $this->faker->cityPrefix();
  20. $this->assertNotEmpty($cityPrefix);
  21. $this->assertInternalType('string', $cityPrefix);
  22. $this->assertRegExp('/[A-Z][a-z]+/', $cityPrefix);
  23. }
  24. public function testStreetSuffix()
  25. {
  26. $streetSuffix = $this->faker->streetSuffix();
  27. $this->assertNotEmpty($streetSuffix);
  28. $this->assertInternalType('string', $streetSuffix);
  29. $this->assertRegExp('/[A-Z][a-z]+/', $streetSuffix);
  30. }
  31. public function testState()
  32. {
  33. $state = $this->faker->state();
  34. $this->assertNotEmpty($state);
  35. $this->assertInternalType('string', $state);
  36. $this->assertRegExp('/[A-Z][a-z]+/', $state);
  37. }
  38. }
  39. ?>