diff --git a/.gitignore b/.gitignore index 7579f74311..9990be6098 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vendor composer.lock +.idea/ diff --git a/readme.md b/readme.md index 6bca447752..9591c9224c 100644 --- a/readme.md +++ b/readme.md @@ -778,6 +778,29 @@ Fugiat non in itaque sunt nobis totam. Sed nesciunt est deleniti cumque alias. R ## Language specific formatters +### `Faker\Provider\ar_EG\Person` + +```php +nationalIdNumber; // Citizen ID number (14-digit). ex: 20661507756430 +``` + +### `Faker\Provider\ar_EG\Address` + +```php +echo $faker->subDivision; // Governors subdvisions. ex: 'مركز بنها' +echo $faker->governors; // Governors names. ex: 'القاهرة' +echo $faker->secondaryAddress; // Secondary address. ex: 'عمارة رقم 20' +echo $faker->streetPrefix; // Street prefix. ex: 'طريق' +``` + +### `Faker\Provider\ar_EG\Company` + +```php +echo $faker->companyPrefix; // Company name prefix. ex: شركة +``` + ### `Faker\Provider\ar_SA\Person` ```php diff --git a/src/Faker/Provider/ar_EG/Address.php b/src/Faker/Provider/ar_EG/Address.php new file mode 100644 index 0000000000..5b6d130aca --- /dev/null +++ b/src/Faker/Provider/ar_EG/Address.php @@ -0,0 +1,134 @@ +generator->parse($format)); + } + + /** + * @example welove.eg + * @return string + */ + public function domainName() + { + return static::randomElement(static::$lastNameAscii).'.'.$this->tld(); + } +} diff --git a/src/Faker/Provider/ar_EG/Person.php b/src/Faker/Provider/ar_EG/Person.php new file mode 100644 index 0000000000..5bf87c3b1b --- /dev/null +++ b/src/Faker/Provider/ar_EG/Person.php @@ -0,0 +1,114 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + public function testEmailIsValid() + { + $email = $this->faker->email; + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/test/Faker/Provider/ar_EG/PersonTest.php b/test/Faker/Provider/ar_EG/PersonTest.php new file mode 100644 index 0000000000..f5fccdccc7 --- /dev/null +++ b/test/Faker/Provider/ar_EG/PersonTest.php @@ -0,0 +1,50 @@ +addProvider(new Person($faker)); + + $this->faker = $faker; + } + + public function testValidLengthOfNationalIdNumber() + { + $nationalIdNumber = $this->faker->nationalIdNumber; + + $this->assertInternalType('string', $nationalIdNumber); + $this->assertEquals(14, strlen($nationalIdNumber)); + } + + public function testIfNamePrefixIsCorrect() + { + $prefix = $this->faker->prefix; + + $this->assertContains('.', $prefix); + } + + public function testIfFirstNameMaleCanReturnData() + { + $firstNameMale = $this->faker->firstNameMale; + $this->assertNotEmpty($firstNameMale); + } + + public function testIfFirstNameFemaleCanReturnData() + { + $firstNameFemale = $this->faker->firstNameFemale; + $this->assertNotEmpty($firstNameFemale); + } +} \ No newline at end of file