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

Added PhoneNumber for the de_AT Provider and missing test for the 'locale' method. #395

Merged
merged 4 commits into from
Aug 20, 2014
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
19 changes: 19 additions & 0 deletions src/Faker/Provider/de_AT/PhoneNumber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Faker\Provider\de_AT;

class PhoneNumber extends \Faker\Provider\PhoneNumber
{
protected static $formats = array(
'0650 #######',
'0660 #######',
'0664 #######',
'0676 #######',
'0677 #######',
'0678 #######',
'0699 #######',
'0680 #######',
'+43 #### ####',
'+43 #### ####-##',
);
}
5 changes: 5 additions & 0 deletions test/Faker/Provider/MiscellaneousTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public function testSha256()
$this->assertRegExp('/^[a-z0-9]{64}$/', Miscellaneous::sha256());
}

public function testLocale()
{
$this->assertRegExp('/^[a-z]{2,3}_[A-Z]{2}$/', Miscellaneous::locale());
}

public function testCountryCode()
{
$this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode());
Expand Down
28 changes: 28 additions & 0 deletions test/Faker/Provider/de_AT/PhoneNumberTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Faker\Test\Provider\de_AT;

use Faker\Generator;
use Faker\Provider\de_AT\PhoneNumber;

class PhoneNumberTest extends \PHPUnit_Framework_TestCase
{

/**
* @var Generator
*/
private $faker;

public function setUp()
{
$faker = new Generator();
$faker->addProvider(new PhoneNumber($faker));
$this->faker = $faker;
}

public function testPhoneNumberFormat()
{
$number = $this->faker->phoneNumber;
$this->assertRegExp('/^06\d{2} \d{7}|\+43 \d{4} \d{4}(-\d{2})?$/', $number);
}
}