mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-25 12:19:11 -04:00
Include Vendor
This commit is contained in:
74
vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php
vendored
Normal file
74
vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/CompanyTest.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\fr_FR;
|
||||
|
||||
use Faker\Calculator\Luhn;
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\fr_FR\Company;
|
||||
|
||||
class CompanyTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Company($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testSiretReturnsAValidSiret()
|
||||
{
|
||||
$siret = $this->faker->siret(false);
|
||||
$this->assertRegExp("/^\d{14}$/", $siret);
|
||||
$this->assertTrue(Luhn::isValid($siret));
|
||||
}
|
||||
|
||||
public function testSiretReturnsAWellFormattedSiret()
|
||||
{
|
||||
$siret = $this->faker->siret();
|
||||
$this->assertRegExp("/^\d{3}\s\d{3}\s\d{3}\s\d{5}$/", $siret);
|
||||
$siret = str_replace(' ', '', $siret);
|
||||
$this->assertTrue(Luhn::isValid($siret));
|
||||
}
|
||||
|
||||
public function testSirenReturnsAValidSiren()
|
||||
{
|
||||
$siren = $this->faker->siren(false);
|
||||
$this->assertRegExp("/^\d{9}$/", $siren);
|
||||
$this->assertTrue(Luhn::isValid($siren));
|
||||
}
|
||||
|
||||
public function testSirenReturnsAWellFormattedSiren()
|
||||
{
|
||||
$siren = $this->faker->siren();
|
||||
$this->assertRegExp("/^\d{3}\s\d{3}\s\d{3}$/", $siren);
|
||||
$siren = str_replace(' ', '', $siren);
|
||||
$this->assertTrue(Luhn::isValid($siren));
|
||||
}
|
||||
|
||||
public function testCatchPhraseReturnsValidCatchPhrase()
|
||||
{
|
||||
$this->assertTrue(TestableCompany::isCatchPhraseValid($this->faker->catchPhrase()));
|
||||
}
|
||||
|
||||
public function testIsCatchPhraseValidReturnsFalseWhenAWordsAppearsTwice()
|
||||
{
|
||||
$isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute sécurité');
|
||||
$this->assertFalse($isCatchPhraseValid);
|
||||
}
|
||||
|
||||
public function testIsCatchPhraseValidReturnsTrueWhenNoWordAppearsTwice()
|
||||
{
|
||||
$isCatchPhraseValid = TestableCompany::isCatchPhraseValid('La sécurité de rouler en toute simplicité');
|
||||
$this->assertTrue($isCatchPhraseValid);
|
||||
}
|
||||
}
|
||||
|
||||
class TestableCompany extends Company
|
||||
{
|
||||
public static function isCatchPhraseValid($catchPhrase)
|
||||
{
|
||||
return parent::isCatchPhraseValid($catchPhrase);
|
||||
}
|
||||
}
|
||||
36
vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php
vendored
Normal file
36
vendor/fzaninotto/faker/test/Faker/Provider/fr_FR/PersonTest.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\fr_FR;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\fr_FR\Person;
|
||||
|
||||
class PersonTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testNIRReturnsTheRightGender()
|
||||
{
|
||||
$nir = $this->faker->nir(\Faker\Provider\Person::GENDER_MALE);
|
||||
$this->assertStringStartsWith('1', $nir);
|
||||
}
|
||||
|
||||
public function testNIRReturnsTheRightPattern()
|
||||
{
|
||||
$nir = $this->faker->nir;
|
||||
$this->assertRegExp("/^[12]\d{5}[0-9A-B]\d{8}$/", $nir);
|
||||
}
|
||||
|
||||
public function testNIRFormattedReturnsTheRightPattern()
|
||||
{
|
||||
$nir = $this->faker->nir(null, true);
|
||||
$this->assertRegExp("/^[12]\s\d{2}\s\d{2}\s\d{1}[0-9A-B]\s\d{3}\s\d{3}\s\d{2}$/", $nir);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user