diff --git a/src/Faker/Provider/en_AU/Address.php b/src/Faker/Provider/en_AU/Address.php index e5077fa4f1..395162fbe9 100644 --- a/src/Faker/Provider/en_AU/Address.php +++ b/src/Faker/Provider/en_AU/Address.php @@ -80,4 +80,31 @@ public static function buildingLetter() { return static::toUpper(static::randomElement(static::$buildingLetters)); } + + /** + * Returns a sane city prefix + * @example West + */ + public static function cityPrefix() + { + return static::randomElement(static::$cityPrefix); + } + + /** + * Returns a sane street suffix + * @example Beach + */ + public static function streetSuffix() + { + return static::randomElement(static::$streetSuffix); + } + + /** + * Returns a sane state + * @example New South Wales + */ + public static function state() + { + return static::randomElement(static::$state); + } } diff --git a/test/Faker/Provider/en_AU/AddressTest.php b/test/Faker/Provider/en_AU/AddressTest.php new file mode 100644 index 0000000000..ef8e9f2ef9 --- /dev/null +++ b/test/Faker/Provider/en_AU/AddressTest.php @@ -0,0 +1,48 @@ +addProvider(new Address($faker)); + $this->faker = $faker; + } + + public function testCityPrefix() + { + $cityPrefix = $this->faker->cityPrefix(); + $this->assertNotEmpty($cityPrefix); + $this->assertInternalType('string', $cityPrefix); + $this->assertRegExp('/[A-Z][a-z]+/', $cityPrefix); + } + + public function testStreetSuffix() + { + $streetSuffix = $this->faker->streetSuffix(); + $this->assertNotEmpty($streetSuffix); + $this->assertInternalType('string', $streetSuffix); + $this->assertRegExp('/[A-Z][a-z]+/', $streetSuffix); + } + + public function testState() + { + $state = $this->faker->state(); + $this->assertNotEmpty($state); + $this->assertInternalType('string', $state); + $this->assertRegExp('/[A-Z][a-z]+/', $state); + } +} + +?>