You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
716 B

<?php
namespace Faker\Test\Provider;
use Faker\Generator;
use Faker\Calculator\Luhn;
use Faker\Provider\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->e164PhoneNumber();
$this->assertRegExp('/^\+[0-9]{11,}$/', $number);
}
public function testImeiReturnsValidNumber()
{
$imei = $this->faker->imei();
$this->assertTrue(Luhn::isValid($imei));
}
}