Skip to content

Commit

Permalink
Remove invalid postcode pattern for France (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
ker0x authored Aug 26, 2023
1 parent 840d2e9 commit af7428b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Faker/Provider/fr_FR/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class Address extends \Faker\Provider\Address
];

protected static $buildingNumber = ['%', '%#', '%#', '%#', '%##'];
protected static $postcode = ['#####', '## ###'];

/**
* @see https://en.wikipedia.org/wiki/Postal_codes_in_France
*/
protected static $postcode = ['#####'];

protected static $country = [
'Afghanistan', 'Afrique du sud', 'Albanie', 'Algérie', 'Allemagne', 'Andorre', 'Angola', 'Anguilla', 'Antarctique', 'Antigua et Barbuda', 'Antilles néerlandaises', 'Arabie saoudite', 'Argentine', 'Arménie', 'Aruba', 'Australie', 'Autriche', 'Azerbaïdjan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Belgique', 'Belize', 'Benin', 'Bermudes (Les)', 'Bhoutan', 'Biélorussie', 'Bolivie', 'Bosnie-Herzégovine', 'Botswana', 'Bouvet (Îles)', 'Brunei', 'Brésil', 'Bulgarie', 'Burkina Faso', 'Burundi', 'Cambodge', 'Cameroun', 'Canada', 'Cap Vert', 'Cayman (Îles)', 'Chili', 'Chine (Rép. pop.)', 'Christmas (Île)', 'Chypre', 'Cocos (Îles)', 'Colombie', 'Comores', 'Cook (Îles)', 'Corée du Nord', 'Corée, Sud', 'Costa Rica', 'Croatie', 'Cuba', 'Côte d\'Ivoire', 'Danemark', 'Djibouti', 'Dominique', 'Égypte', 'El Salvador', 'Émirats arabes unis', 'Équateur', 'Érythrée', 'Espagne', 'Estonie', 'États-Unis', 'Ethiopie', 'Falkland (Île)', 'Fidji (République des)', 'Finlande', 'France', 'Féroé (Îles)', 'Gabon',
Expand Down
8 changes: 8 additions & 0 deletions test/Faker/Provider/fr_FR/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
*/
final class AddressTest extends TestCase
{
public function testPostcode(): void
{
$postcode = $this->faker->postcode();
self::assertNotEmpty($postcode);
self::assertIsString($postcode);
self::assertMatchesRegularExpression('@^\d{5}$@', $postcode);
}

public function testSecondaryAddress(): void
{
self::assertEquals('Étage 007', $this->faker->secondaryAddress());
Expand Down

0 comments on commit af7428b

Please sign in to comment.