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 #395 from bessl/master
Browse files Browse the repository at this point in the history
Added PhoneNumber for the de_AT Provider and missing test for the 'locale' method.
  • Loading branch information
fzaninotto committed Aug 20, 2014
2 parents d46b8f5 + 92b53d4 commit 41fd7ff
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
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);
}
}

0 comments on commit 41fd7ff

Please sign in to comment.