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

Add a building number with letter to German speaking locales. #903

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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