From fd12ae071423c4ce6528f842b7a8641e7c5715d3 Mon Sep 17 00:00:00 2001 From: selmonal Date: Fri, 25 Sep 2015 19:12:42 +0900 Subject: [PATCH 1/2] Add Mongolian Provider --- src/Faker/Provider/mn_MN/Person.php | 100 +++++++++++++++++++++++ src/Faker/Provider/mn_MN/PhoneNumber.php | 13 +++ test/Faker/Provider/mn_MN/PersonTest.php | 27 ++++++ 3 files changed, 140 insertions(+) create mode 100644 src/Faker/Provider/mn_MN/Person.php create mode 100644 src/Faker/Provider/mn_MN/PhoneNumber.php create mode 100644 test/Faker/Provider/mn_MN/PersonTest.php diff --git a/src/Faker/Provider/mn_MN/Person.php b/src/Faker/Provider/mn_MN/Person.php new file mode 100644 index 0000000000..4b909e2d7d --- /dev/null +++ b/src/Faker/Provider/mn_MN/Person.php @@ -0,0 +1,100 @@ +generator->parse(static::$idNumberFormat)); + } + + /** + * @return string + * @example 'Ф' + */ + public function alphabet() + { + return static::randomElement(static::$alphabet); + } + + /** + * @return string + * @example 'Э' + */ + public function namePrefix() + { + return static::randomElement(static::$namePrefix); + } +} diff --git a/src/Faker/Provider/mn_MN/PhoneNumber.php b/src/Faker/Provider/mn_MN/PhoneNumber.php new file mode 100644 index 0000000000..dd0bb4aba7 --- /dev/null +++ b/src/Faker/Provider/mn_MN/PhoneNumber.php @@ -0,0 +1,13 @@ +addProvider(new Person($faker)); + $faker->seed(1); + + $this->assertRegExp('/^[А-Я]{1}\.[\w\W]+$/u', $faker->name); + } + + public function testIdNumber() + { + $faker = new Generator(); + $faker->addProvider(new Person($faker)); + $faker->seed(2); + + $this->assertRegExp('/^[А-Я]{2}\d{8}$/u', $faker->idNumber); + } +} From 39331f1ac251b3e5a010f0d63df526f48e1cedcf Mon Sep 17 00:00:00 2001 From: selmonal Date: Fri, 25 Sep 2015 19:27:40 +0900 Subject: [PATCH 2/2] remove white space --- src/Faker/Provider/mn_MN/Person.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Faker/Provider/mn_MN/Person.php b/src/Faker/Provider/mn_MN/Person.php index 4b909e2d7d..8a0b8206ac 100644 --- a/src/Faker/Provider/mn_MN/Person.php +++ b/src/Faker/Provider/mn_MN/Person.php @@ -3,9 +3,9 @@ namespace Faker\Provider\mn_MN; class Person extends \Faker\Provider\Person -{ +{ /** - * @source http://ner.query.mn/son + * @link http://ner.query.mn/son */ protected static $firstNameMale = array( 'Агь-Од', 'Адархидай', 'Адхираг', 'Ажай', 'Аз-Оргил', 'Алаг-Наяа', 'Алахуш-дигитхури', 'Алдиэр', 'Алтаннар', 'Алхуй', 'Алчи', 'Алчидай', 'Амал', 'Амбагай', 'Амин-Эрдэнэ', 'Анхлан', 'Арачиан', 'Аргасун', 'Арин', 'Арулад', 'Архай Хасар', 'Аучу', 'Ачиг-Чирүн', 'Ачиг-Ширүн', 'Аша-хамбу', @@ -36,7 +36,7 @@ class Person extends \Faker\Provider\Person ); /** - * @source http://ner.query.mn/daugther + * @link http://ner.query.mn/daugther */ protected static $firstNameFemale = array( 'Агь-Од', 'Алагабэх', 'Алалтун', 'Алахчит', 'Амин-Эрдэнэ', 'Анхлан',