Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #903 from markuspoerschke/building_numbers_with_le…
Browse files Browse the repository at this point in the history
…tters_de

Add a building number with letter to German speaking locales.
  • Loading branch information
fzaninotto committed May 10, 2016
2 parents 30f2b96 + 38a7b48 commit 191fc2b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/Faker/Provider/de_AT/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Address extends \Faker\Provider\Address
{
protected static $buildingNumber = array('###', '##', '#');
protected static $buildingNumber = array('###', '##', '#', '##[abc]', '#[abc]');

protected static $streetSuffixLong = array(
'Gasse', 'Platz', 'Ring', 'Straße', 'Weg',
Expand Down Expand Up @@ -108,4 +108,9 @@ public static function state()
{
return static::randomElement(static::$state);
}

public static function buildingNumber()
{
return static::regexify(self::numerify(static::randomElement(static::$buildingNumber)));
}
}
7 changes: 6 additions & 1 deletion src/Faker/Provider/de_CH/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Address extends \Faker\Provider\Address
{
protected static $buildingNumber = array('###', '##', '#', '#a', '#b', '#c');
protected static $buildingNumber = array('###', '##', '#', '##[abc]', '#[abc]');

protected static $streetSuffixLong = array(
'Gasse', 'Platz', 'Ring', 'Strasse', 'Weg', 'Allee'
Expand Down Expand Up @@ -177,4 +177,9 @@ public static function cantonName()
$canton = static::canton();
return current($canton);
}

public static function buildingNumber()
{
return static::regexify(self::numerify(static::randomElement(static::$buildingNumber)));
}
}
7 changes: 6 additions & 1 deletion src/Faker/Provider/de_DE/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Address extends \Faker\Provider\Address
{
protected static $buildingNumber = array('###', '##', '#', '#/#');
protected static $buildingNumber = array('###', '##', '#', '#/#', '##[abc]', '#[abc]');

protected static $streetSuffixLong = array(
'Gasse', 'Platz', 'Ring', 'Straße', 'Weg', 'Allee'
Expand Down Expand Up @@ -87,4 +87,9 @@ public static function state()
{
return static::randomElement(static::$state);
}

public static function buildingNumber()
{
return static::regexify(self::numerify(static::randomElement(static::$buildingNumber)));
}
}
8 changes: 5 additions & 3 deletions test/Faker/Provider/en_SG/PhoneNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

class PhoneNumberTest extends \PHPUnit_Framework_TestCase
{
private $faker;

public function setUp()
{
$faker = Factory::create('en_SG');
$faker->addProvider(new PhoneNumber($faker));
$this->faker = $faker;
$this->faker = Factory::create('en_SG');
$this->faker->seed(1);
$this->faker->addProvider(new PhoneNumber($this->faker));
}

// http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore#Numbering_plan
Expand Down

0 comments on commit 191fc2b

Please sign in to comment.