diff --git a/src/Faker/Provider/Miscellaneous.php b/src/Faker/Provider/Miscellaneous.php index f240f56cb7..550f825b0c 100644 --- a/src/Faker/Provider/Miscellaneous.php +++ b/src/Faker/Provider/Miscellaneous.php @@ -8,6 +8,8 @@ class Miscellaneous extends \Faker\Provider\Base protected static $countryCode = array('CA', 'CN', 'DE', 'ES', 'FR', 'IE', 'IN', 'IT', 'MX', 'PT', 'RU', 'GB', 'US'); + protected static $countryISOAlpha3 = array('CAN', 'CHN', 'DEU', 'ESP', 'FRA', 'IRL', 'IND', 'ITA', 'MEX', 'PRT', 'RUS', 'GBR', 'USA'); + protected static $localeData = array( 'aa_DJ', 'aa_ER', 'aa_ET', 'af_NA', 'af_ZA', 'ak_GH', @@ -142,6 +144,14 @@ public static function countryCode() return static::randomElement(static::$countryCode); } + /** + * @example 'FRA' + */ + public static function countryISOAlpha3() + { + return static::randomElement(static::$countryISOAlpha3); + } + /** * @example 'fr' */ diff --git a/test/Faker/Provider/MiscellaneousTest.php b/test/Faker/Provider/MiscellaneousTest.php index 779583759f..5de85eaeae 100644 --- a/test/Faker/Provider/MiscellaneousTest.php +++ b/test/Faker/Provider/MiscellaneousTest.php @@ -37,6 +37,11 @@ public function testCountryCode() $this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode()); } + public function testCountryISOAlpha3() + { + $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::countryISOAlpha3()); + } + public function testLanguage() { $this->assertRegExp('/^[a-z]{2}$/', Miscellaneous::languageCode());