diff --git a/src/Faker/Provider/de_CH/Address.php b/src/Faker/Provider/de_CH/Address.php new file mode 100644 index 0000000000..c892819672 --- /dev/null +++ b/src/Faker/Provider/de_CH/Address.php @@ -0,0 +1,180 @@ + 'Aargau'), + array('AI' => 'Appenzell Innerrhoden'), + array('AR' => 'Appenzell Ausserrhoden'), + array('BE' => 'Bern'), + array('BL' => 'Basel-Landschaft'), + array('BS' => 'Basel-Stadt'), + array('FR' => 'Freiburg'), + array('GE' => 'Genf'), + array('GL' => 'Glarus'), + array('GR' => 'Graubünden'), + array('JU' => 'Jura',), + array('LU' => 'Luzern'), + array('NE' => 'Neuenburg'), + array('NW' => 'Nidwalden'), + array('OW' => 'Obwalden'), + array('SG' => 'St. Gallen'), + array('SH' => 'Schaffhausen'), + array('SO' => 'Solothurn'), + array('SZ' => 'Schwyz'), + array('TG' => 'Thurgau'), + array('TI' => 'Tessin'), + array('UR' => 'Uri'), + array('VD' => 'Waadt'), + array('VS' => 'Wallis'), + array('ZG' => 'Zug'), + array('ZH' => 'Zürich') + ); + + protected static $country = array( + 'Afghanistan', 'Alandinseln', 'Albanien', 'Algerien', 'Amerikanisch-Ozeanien', 'Amerikanisch-Samoa', 'Amerikanische Jungferninseln', 'Andorra', 'Angola', 'Anguilla', 'Antarktis', 'Antigua und Barbuda', 'Argentinien', 'Armenien', 'Aruba', 'Aserbaidschan', 'Australien', 'Ägypten', 'Äquatorialguinea', 'Äthiopien', 'Äusseres Ozeanien', + 'Bahamas', 'Bahrain', 'Bangladesch', 'Barbados', 'Belarus', 'Belgien', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivien', 'Bosnien und Herzegowina', 'Botsuana', 'Bouvetinsel', 'Brasilien', 'Britische Jungferninseln', 'Britisches Territorium im Indischen Ozean', 'Brunei Darussalam', 'Bulgarien', 'Burkina Faso', 'Burundi', + 'Chile', 'China', 'Cookinseln', 'Costa Rica', 'Côte d’Ivoire', + 'Demokratische Republik Kongo', 'Demokratische Volksrepublik Korea', 'Deutschland', 'Dominica', 'Dominikanische Republik', 'Dschibuti', 'Dänemark', + 'Ecuador', 'El Salvador', 'Eritrea', 'Estland', 'Europäische Union', + 'Falklandinseln', 'Fidschi', 'Finnland', 'Frankreich', 'Französisch-Guayana', 'Französisch-Polynesien', 'Französische Süd- und Antarktisgebiete', 'Färöer', + 'Gabun', 'Gambia', 'Georgien', 'Ghana', 'Gibraltar', 'Grenada', 'Griechenland', 'Grönland', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', + 'Haiti', 'Heard- und McDonald-Inseln', 'Honduras', + 'Indien', 'Indonesien', 'Irak', 'Iran', 'Irland', 'Island', 'Isle of Man', 'Israel', 'Italien', + 'Jamaika', 'Japan', 'Jemen', 'Jersey', 'Jordanien', + 'Kaimaninseln', 'Kambodscha', 'Kamerun', 'Kanada', 'Kap Verde', 'Kasachstan', 'Katar', 'Kenia', 'Kirgisistan', 'Kiribati', 'Kokosinseln', 'Kolumbien', 'Komoren', 'Kongo', 'Kroatien', 'Kuba', 'Kuwait', + 'Laos', 'Lesotho', 'Lettland', 'Libanon', 'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxemburg', + 'Madagaskar', 'Malawi', 'Malaysia', 'Malediven', 'Mali', 'Malta', 'Marokko', 'Marshallinseln', 'Martinique', 'Mauretanien', 'Mauritius', 'Mayotte', 'Mazedonien', 'Mexiko', 'Mikronesien', 'Monaco', 'Mongolei', 'Montenegro', 'Montserrat', 'Mosambik', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'Neukaledonien', 'Neuseeland', 'Nicaragua', 'Niederlande', 'Niederländische Antillen', 'Niger', 'Nigeria', 'Niue', 'Norfolkinsel', 'Norwegen', 'Nördliche Marianen', + 'Oman', 'Osttimor', 'Österreich', + 'Pakistan', 'Palau', 'Palästinensische Gebiete', 'Panama', 'Papua-Neuguinea', 'Paraguay', 'Peru', 'Philippinen', 'Pitcairn', 'Polen', 'Portugal', 'Puerto Rico', + 'Republik Korea', 'Republik Moldau', 'Ruanda', 'Rumänien', 'Russische Föderation', 'Réunion', + 'Salomonen', 'Sambia', 'Samoa', 'San Marino', 'Saudi-Arabien', 'Schweden', 'Schweiz', 'Senegal', 'Serbien', 'Serbien und Montenegro', 'Seychellen', 'Sierra Leone', 'Simbabwe', 'Singapur', 'Slowakei', 'Slowenien', 'Somalia', 'Sonderverwaltungszone Hongkong', 'Sonderverwaltungszone Macao', 'Spanien', 'Sri Lanka', 'St. Barthélemy', 'St. Helena', 'St. Kitts und Nevis', 'St. Lucia', 'St. Martin', 'St. Pierre und Miquelon', 'St. Vincent und die Grenadinen', 'Sudan', 'Suriname', 'Svalbard und Jan Mayen', 'Swasiland', 'Syrien', 'São Tomé und Príncipe', 'Südafrika', 'Südgeorgien und die Südlichen Sandwichinseln', + 'Tadschikistan', 'Taiwan', 'Tansania', 'Thailand', 'Togo', 'Tokelau', 'Tonga', 'Trinidad und Tobago', 'Tschad', 'Tschechische Republik', 'Tunesien', 'Turkmenistan', 'Turks- und Caicosinseln', 'Tuvalu', 'Türkei', + 'Uganda', 'Ukraine', 'Unbekannte oder ungültige Region', 'Ungarn', 'Uruguay', 'Usbekistan', + 'Vanuatu', 'Vatikanstadt', 'Venezuela', 'Vereinigte Arabische Emirate', 'Vereinigte Staaten', 'Vereinigtes Königreich', 'Vietnam', + 'Wallis und Futuna', 'Weihnachtsinsel', 'Westsahara', + 'Zentralafrikanische Republik', 'Zypern', + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{lastName}}{{streetSuffixShort}}', + '{{cityName}}{{streetSuffixShort}}', + '{{firstName}}-{{lastName}}-{{streetSuffixLong}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a random street suffix. + * @example str. + * @return string + */ + public function streetSuffixShort() + { + return static::randomElement(static::$streetSuffixShort); + } + + /** + * Returns a random street suffix. + * @example Strasse + * @return string + */ + public function streetSuffixLong() + { + return static::randomElement(static::$streetSuffixLong); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/src/Faker/Provider/de_CH/Company.php b/src/Faker/Provider/de_CH/Company.php new file mode 100644 index 0000000000..604ec5ae8e --- /dev/null +++ b/src/Faker/Provider/de_CH/Company.php @@ -0,0 +1,15 @@ + 'Argovie'), + array('AI' => 'Appenzell Rhodes-Intérieures'), + array('AR' => 'Appenzell Rhodes-Extérieures'), + array('BE' => 'Berne'), + array('BL' => 'Bâle-Campagne'), + array('BS' => 'Bâle-Ville'), + array('FR' => 'Fribourg'), + array('GE' => 'Genève'), + array('GL' => 'Glaris'), + array('GR' => 'Grisons'), + array('JU' => 'Jura'), + array('LU' => 'Lucerne'), + array('NE' => 'Neuchâtel'), + array('NW' => 'Nidwald'), + array('OW' => 'Obwald'), + array('SG' => 'Saint-Gall'), + array('SH' => 'Schaffhouse'), + array('SO' => 'Soleure'), + array('SZ' => 'Schwytz'), + array('TG' => 'Thurgovie'), + array('TI' => 'Tessin'), + array('UR' => 'Uri'), + array('VD' => 'Vaud'), + array('VS' => 'Valais'), + array('ZG' => 'Zoug'), + array('ZH' => 'Zurich') + ); + + protected static $country = array( + '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', + 'Gambie', 'Ghana', 'Gibraltar', 'Grenade', 'Groenland', 'Grèce', 'Guadeloupe', 'Guam', 'Guatemala', 'Guinée', 'Guinée Equatoriale', 'Guinée-Bissau', 'Guyane', 'Guyane française', 'Géorgie', 'Géorgie du Sud et Sandwich du Sud (Îles)', 'Haïti', 'Heard et McDonald (Îles)', 'Honduras', 'Hong Kong', 'Hongrie', 'Îles Mineures Éloignées des États-Unis', 'Inde', 'Indonésie', 'Irak', 'Iran', 'Irlande', 'Islande', 'Israël', 'Italie', 'Jamaïque', 'Japon', 'Jordanie', 'Kazakhstan', 'Kenya', 'Kirghizistan', 'Kiribati', 'Koweit', 'La Barbad', 'Laos', 'Lesotho', 'Lettonie', 'Liban', 'Libye', 'Libéria', 'Liechtenstein', 'Lithuanie', 'Luxembourg', 'Macau', 'Macédoine', 'Madagascar', 'Malaisie', 'Malawi', 'Maldives (Îles)', 'Mali', 'Malte', 'Mariannes du Nord (Îles)', 'Maroc', 'Marshall (Îles)', 'Martinique', 'Maurice', 'Mauritanie', 'Mayotte', 'Mexique', 'Micronésie (États fédérés de)', 'Moldavie', 'Monaco', 'Mongolie', 'Montserrat', 'Mozambique', 'Myanmar', 'Namibie', 'Nauru', 'Nepal', + 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk (Îles)', 'Norvège', 'Nouvelle Calédonie', 'Nouvelle-Zélande', 'Oman', 'Ouganda', 'Ouzbékistan', 'Pakistan', 'Palau', 'Panama', 'Papouasie-Nouvelle-Guinée', 'Paraguay', 'Pays-Bas', 'Philippines', 'Pitcairn (Îles)', 'Pologne', 'Polynésie française', 'Porto Rico', 'Portugal', 'Pérou', 'Qatar', 'Roumanie', 'Royaume-Uni', 'Russie', 'Rwanda', 'Rép. Dém. du Congo', 'République centrafricaine', 'République Dominicaine', 'République tchèque', 'Réunion (La)', 'Sahara Occidental', 'Saint Pierre et Miquelon', 'Saint Vincent et les Grenadines', 'Saint-Kitts et Nevis', 'Saint-Marin (Rép. de)', 'Sainte Hélène', 'Sainte Lucie', 'Samoa', 'Samoa', 'Seychelles', 'Sierra Leone', 'Singapour', 'Slovaquie', 'Slovénie', 'Somalie', 'Soudan', 'Sri Lanka', 'Suisse', 'Suriname', 'Suède', 'Svalbard et Jan Mayen (Îles)', 'Swaziland', 'Syrie', 'São Tomé et Príncipe (Rép.)', 'Sénégal', 'Tadjikistan', 'Taiwan', 'Tanzanie', 'Tchad', + 'Territoire britannique de l\'océan Indien', 'Territoires français du sud', 'Thailande', 'Timor', 'Togo', 'Tokelau', 'Tonga', 'Trinité et Tobago', 'Tunisie', 'Turkménistan', 'Turks et Caïques (Îles)', 'Turquie', 'Tuvalu', 'Ukraine', 'Uruguay', 'Vanuatu', 'Vatican (Etat du)', 'Venezuela', 'Vierges (Îles)', 'Vierges britanniques (Îles)', 'Vietnam', 'Wallis et Futuna (Îles)', 'Yemen', 'Yougoslavie', 'Zambie', 'Zaïre', 'Zimbabwe' + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{streetPrefix}} {{lastName}}', + '{{streetPrefix}} de {{cityName}}', + '{{streetPrefix}} de {{lastName}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random street prefix + * @example Rue + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/src/Faker/Provider/fr_CH/Company.php b/src/Faker/Provider/fr_CH/Company.php new file mode 100644 index 0000000000..bf3b0ae8ec --- /dev/null +++ b/src/Faker/Provider/fr_CH/Company.php @@ -0,0 +1,15 @@ + 'Argovia'), + array('AI' => 'Appenzello Interno'), + array('AR' => 'Appenzello Esterno'), + array('BE' => 'Berna'), + array('BL' => 'Basilea Campagna'), + array('BS' => 'Basilea Città'), + array('FR' => 'Friburgo'), + array('GE' => 'Ginevra'), + array('GL' => 'Glarona'), + array('GR' => 'Grigioni'), + array('JU' => 'Giura'), + array('LU' => 'Lucerna'), + array('NE' => 'Neuchâtel'), + array('NW' => 'Nidvaldo'), + array('OW' => 'Obvaldo'), + array('SG' => 'San Gallo'), + array('SH' => 'Sciaffusa'), + array('SO' => 'Soletta'), + array('SZ' => 'Svitto'), + array('TG' => 'Turgovia'), + array('TI' => 'Ticino'), + array('UR' => 'Uri'), + array('VD' => 'Vaud'), + array('VS' => 'Vallese'), + array('ZG' => 'Zugo'), + array('ZH' => 'Zurigo') + ); + + protected static $country = array( + 'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antartide (territori a sud del 60° parallelo)', 'Antigua e Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan', + 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Bielorussia', 'Belgio', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia e Herzegovina', 'Botswana', 'Bouvet Island (Bouvetoya)', 'Brasile', 'Territorio dell\'arcipelago indiano', 'Isole Vergini Britanniche', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi', + 'Cambogia', 'Cameroon', 'Canada', 'Capo Verde', 'Isole Cayman', 'Repubblica Centrale Africana', 'Chad', 'Cile', 'Cina', 'Isola di Pasqua', 'Isola di Cocos (Keeling)', 'Colombia', 'Comoros', 'Congo', 'Isole Cook', 'Costa Rica', 'Costa d\'Avorio', 'Croazia', 'Cuba', 'Cipro', 'Repubblica Ceca', + 'Danimarca', 'Gibuti', 'Repubblica Dominicana', + 'Equador', 'Egitto', 'El Salvador', 'Guinea Equatoriale', 'Eritrea', 'Estonia', 'Etiopia', + 'Isole Faroe', 'Isole Falkland (Malvinas)', 'Fiji', 'Finlandia', 'Francia', 'Guyana Francese', 'Polinesia Francese', 'Territori Francesi del sud', + 'Gabon', 'Gambia', 'Georgia', 'Germania', 'Ghana', 'Gibilterra', 'Grecia', 'Groenlandia', 'Grenada', 'Guadalupa', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', + 'Haiti', 'Heard Island and McDonald Islands', 'Città del Vaticano', 'Honduras', 'Hong Kong', 'Ungheria', + 'Islanda', 'India', 'Indonesia', 'Iran', 'Iraq', 'Irlanda', 'Isola di Man', 'Israele', 'Italia', + 'Giamaica', 'Giappone', 'Jersey', 'Giordania', + 'Kazakhstan', 'Kenya', 'Kiribati', 'Korea', 'Kuwait', 'Republicca Kirgiza', + 'Repubblica del Laos', 'Latvia', 'Libano', 'Lesotho', 'Liberia', 'Libyan Arab Jamahiriya', 'Liechtenstein', 'Lituania', 'Lussemburgo', + 'Macao', 'Macedonia', 'Madagascar', 'Malawi', 'Malesia', 'Maldive', 'Mali', 'Malta', 'Isole Marshall', 'Martinica', 'Mauritania', 'Mauritius', 'Mayotte', 'Messico', 'Micronesia', 'Moldova', 'Principato di Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 'Marocco', 'Mozambico', 'Myanmar', + 'Namibia', 'Nauru', 'Nepal', 'Antille Olandesi', 'Olanda', 'Nuova Caledonia', 'Nuova Zelanda', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Isole Norfolk', 'Northern Mariana Islands', 'Norvegia', + 'Oman', + 'Pakistan', 'Palau', 'Palestina', 'Panama', 'Papua Nuova Guinea', 'Paraguay', 'Peru', 'Filippine', 'Pitcairn Islands', 'Polonia', 'Portogallo', 'Porto Rico', + 'Qatar', + 'Reunion', 'Romania', 'Russia', 'Rwanda', + 'San Bartolomeo', 'Sant\'Elena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Martin', 'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Arabia Saudita', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovenia', 'Isole Solomon', 'Somalia', 'Sud Africa', 'Georgia del sud e South Sandwich Islands', 'Spagna', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard & Jan Mayen Islands', 'Swaziland', 'Svezia', 'Svizzera', 'Siria', + 'Taiwan', 'Tajikistan', 'Tanzania', 'Tailandia', 'Timor-Leste', 'Togo', 'Tokelau', 'Tonga', 'Trinidad e Tobago', 'Tunisia', 'Turchia', 'Turkmenistan', 'Isole di Turks and Caicos', 'Tuvalu', + 'Uganda', 'Ucraina', 'Emirati Arabi Uniti', 'Regno Unito', 'Stati Uniti d\'America', 'United States Minor Outlying Islands', 'Isole Vergini Statunitensi', 'Uruguay', 'Uzbekistan', + 'Vanuatu', 'Venezuela', 'Vietnam', + 'Wallis and Futuna', 'Western Sahara', + 'Yemen', + 'Zambia', 'Zimbabwe' + ); + + protected static $cityFormats = array( + '{{cityName}}', + ); + + protected static $streetNameFormats = array( + '{{streetSuffix}} {{firstName}}', + '{{streetSuffix}} {{lastName}}' + ); + + protected static $streetAddressFormats = array( + '{{streetName}} {{buildingNumber}}', + ); + protected static $addressFormats = array( + "{{streetAddress}}\n{{postcode}} {{city}}", + ); + + /** + * Returns a random street prefix + * @example Via + * @return string + */ + public static function streetPrefix() + { + return static::randomElement(static::$streetPrefix); + } + + /** + * Returns a random city name. + * @example Luzern + * @return string + */ + public function cityName() + { + return static::randomElement(static::$cityNames); + } + + /** + * Returns a canton + * @example array('BE' => 'Bern') + * @return array + */ + public static function canton() + { + return static::randomElement(static::$canton); + } + + /** + * Returns the abbreviation of a canton. + * @return string + */ + public static function cantonShort() + { + $canton = static::canton(); + return key($canton); + } + + /** + * Returns the name of canton. + * @return string + */ + public static function cantonName() + { + $canton = static::canton(); + return current($canton); + } +} diff --git a/src/Faker/Provider/it_CH/Company.php b/src/Faker/Provider/it_CH/Company.php new file mode 100644 index 0000000000..9a42b1c3f2 --- /dev/null +++ b/src/Faker/Provider/it_CH/Company.php @@ -0,0 +1,15 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/test/Faker/Provider/de_CH/InternetTest.php b/test/Faker/Provider/de_CH/InternetTest.php new file mode 100644 index 0000000000..907af21036 --- /dev/null +++ b/test/Faker/Provider/de_CH/InternetTest.php @@ -0,0 +1,35 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/test/Faker/Provider/de_CH/PhoneNumberTest.php b/test/Faker/Provider/de_CH/PhoneNumberTest.php new file mode 100644 index 0000000000..a5c117fcbb --- /dev/null +++ b/test/Faker/Provider/de_CH/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + /** + * @test + * @dataProvider phoneNumberFormatProvider + */ + public function phoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+44 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $number); + } + + public function phoneNumberFormatProvider (){ + return array(array(), array(), array(), array(), array(), array(), array(), array(), array(), array()); + } +} diff --git a/test/Faker/Provider/fr_CH/AddressTest.php b/test/Faker/Provider/fr_CH/AddressTest.php new file mode 100644 index 0000000000..f589c1f84e --- /dev/null +++ b/test/Faker/Provider/fr_CH/AddressTest.php @@ -0,0 +1,69 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/test/Faker/Provider/fr_CH/InternetTest.php b/test/Faker/Provider/fr_CH/InternetTest.php new file mode 100644 index 0000000000..2f20871a70 --- /dev/null +++ b/test/Faker/Provider/fr_CH/InternetTest.php @@ -0,0 +1,35 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/test/Faker/Provider/fr_CH/PhoneNumberTest.php b/test/Faker/Provider/fr_CH/PhoneNumberTest.php new file mode 100644 index 0000000000..9ae67dd94d --- /dev/null +++ b/test/Faker/Provider/fr_CH/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + /** + * @test + * @dataProvider phoneNumberFormatProvider + */ + public function phoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+44 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $number); + } + + public function phoneNumberFormatProvider (){ + return array(array(), array(), array(), array(), array(), array(), array(), array(), array(), array()); + } +} diff --git a/test/Faker/Provider/it_CH/AddressTest.php b/test/Faker/Provider/it_CH/AddressTest.php new file mode 100644 index 0000000000..76122532eb --- /dev/null +++ b/test/Faker/Provider/it_CH/AddressTest.php @@ -0,0 +1,69 @@ +addProvider(new Address($faker)); + $faker->addProvider(new Person($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function canton () + { + $canton = $this->faker->canton(); + $this->assertInternalType('array', $canton); + $this->assertCount(1, $canton); + + foreach ($canton as $cantonShort => $cantonName){ + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + } + + /** + * @test + */ + public function cantonName () + { + $cantonName = $this->faker->cantonName(); + $this->assertInternalType('string', $cantonName); + $this->assertGreaterThan(2, strlen($cantonName)); + } + + /** + * @test + */ + public function cantonShort () + { + $cantonShort = $this->faker->cantonShort(); + $this->assertInternalType('string', $cantonShort); + $this->assertEquals(2, strlen($cantonShort)); + } + + /** + * @test + */ + public function address (){ + $address = $this->faker->address(); + $this->assertInternalType('string', $address); + } +} diff --git a/test/Faker/Provider/it_CH/InternetTest.php b/test/Faker/Provider/it_CH/InternetTest.php new file mode 100644 index 0000000000..16616c70c5 --- /dev/null +++ b/test/Faker/Provider/it_CH/InternetTest.php @@ -0,0 +1,35 @@ +addProvider(new Person($faker)); + $faker->addProvider(new Internet($faker)); + $faker->addProvider(new Company($faker)); + $this->faker = $faker; + } + + /** + * @test + */ + public function emailIsValid() + { + $email = $this->faker->email(); + $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL)); + } +} diff --git a/test/Faker/Provider/it_CH/PhoneNumberTest.php b/test/Faker/Provider/it_CH/PhoneNumberTest.php new file mode 100644 index 0000000000..1638a91ac7 --- /dev/null +++ b/test/Faker/Provider/it_CH/PhoneNumberTest.php @@ -0,0 +1,36 @@ +addProvider(new PhoneNumber($faker)); + $this->faker = $faker; + } + + /** + * @test + * @dataProvider phoneNumberFormatProvider + */ + public function phoneNumberFormat() + { + $number = $this->faker->phoneNumber; + $this->assertRegExp('/^0\d{2} ?\d{3} ?\d{2} ?\d{2}|\+44 ?(\(0\))?\d{2} ?\d{3} ?\d{2} ?\d{2}$/', $number); + } + + public function phoneNumberFormatProvider (){ + return array(array(), array(), array(), array(), array(), array(), array(), array(), array(), array()); + } +}