1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
<?php
namespace Faker\Test\Provider\pt_BR;
use Faker\Provider\pt_BR\Person;
use Faker\Test\TestCase;
/**
* @group legacy
*/
final class PersonTest extends TestCase
{
public function testCpfFormatIsValid()
{
$cpf = $this->faker->cpf(false);
self::assertMatchesRegularExpression('/\d{9}\d{2}/', $cpf);
$cpf = $this->faker->cpf(true);
self::assertMatchesRegularExpression('/\d{3}\.\d{3}\.\d{3}-\d{2}/', $cpf);
}
public function testRgFormatIsValid()
{
$rg = $this->faker->rg(false);
self::assertMatchesRegularExpression('/\d{8}\d/', $rg);
$rg = $this->faker->rg(true);
self::assertMatchesRegularExpression('/\d{2}\.\d{3}\.\d{3}-[0-9X]/', $rg);
}
protected function getProviders(): iterable
{
yield new Person($this->faker);
}
}
|