mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-25 20:29:10 -04:00
Include Vendor
This commit is contained in:
26
vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php
vendored
Normal file
26
vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/CompanyTest.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\zh_TW;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\zh_TW\Company;
|
||||
|
||||
class CompanyTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Company($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
public function testVAT()
|
||||
{
|
||||
$this->assertEquals(8, floor(log10($this->faker->VAT) + 1));
|
||||
}
|
||||
}
|
||||
44
vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php
vendored
Normal file
44
vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/PersonTest.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\zh_TW;
|
||||
|
||||
use Faker\Generator;
|
||||
use Faker\Provider\zh_TW\Person;
|
||||
|
||||
class PersonTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Generator
|
||||
*/
|
||||
private $faker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$faker = new Generator();
|
||||
$faker->addProvider(new Person($faker));
|
||||
$this->faker = $faker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89
|
||||
*/
|
||||
public function testPersonalIdentityNumber()
|
||||
{
|
||||
$id = $this->faker->personalIdentityNumber;
|
||||
|
||||
$firstChar = substr($id, 0, 1);
|
||||
$codesString = Person::$idBirthplaceCode[$firstChar] . substr($id, 1);
|
||||
|
||||
// After transfer the first alphabet word into 2 digit number, there should be totally 11 numbers
|
||||
$this->assertRegExp("/^[0-9]{11}$/", $codesString);
|
||||
|
||||
$total = 0;
|
||||
$codesArray = str_split($codesString);
|
||||
foreach ($codesArray as $key => $code) {
|
||||
$total += $code * Person::$idDigitValidator[$key];
|
||||
}
|
||||
|
||||
// Validate
|
||||
$this->assertEquals(0, ($total % 10));
|
||||
}
|
||||
}
|
||||
77
vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php
vendored
Normal file
77
vendor/fzaninotto/faker/test/Faker/Provider/zh_TW/TextTest.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Test\Provider\zh_TW;
|
||||
|
||||
class TextTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $textClass;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->textClass = new \ReflectionClass('Faker\Provider\zh_TW\Text');
|
||||
}
|
||||
|
||||
protected function getMethod($name) {
|
||||
$method = $this->textClass->getMethod($name);
|
||||
|
||||
$method->setAccessible(true);
|
||||
|
||||
return $method;
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function testItShouldExplodeTheStringToArray()
|
||||
{
|
||||
$this->assertSame(
|
||||
array('中', '文', '測', '試', '真', '有', '趣'),
|
||||
$this->getMethod('explode')->invokeArgs(null, array('中文測試真有趣'))
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
array('標', '點', ',', '符', '號', '!'),
|
||||
$this->getMethod('explode')->invokeArgs(null, array('標點,符號!'))
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function testItShouldReturnTheStringLength()
|
||||
{
|
||||
$this->assertContains(
|
||||
$this->getMethod('strlen')->invokeArgs(null, array('中文測試真有趣')),
|
||||
array(7, 21)
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function testItShouldReturnTheCharacterIsValidStartOrNot()
|
||||
{
|
||||
$this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('中')));
|
||||
|
||||
$this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('2')));
|
||||
|
||||
$this->assertTrue($this->getMethod('validStart')->invokeArgs(null, array('Hello')));
|
||||
|
||||
$this->assertFalse($this->getMethod('validStart')->invokeArgs(null, array('。')));
|
||||
|
||||
$this->assertFalse($this->getMethod('validStart')->invokeArgs(null, array('!')));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function testItShouldAppendEndPunctToTheEndOfString()
|
||||
{
|
||||
$this->assertSame(
|
||||
'中文測試真有趣。',
|
||||
$this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣'))
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
'中文測試真有趣。',
|
||||
$this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣,'))
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
'中文測試真有趣!',
|
||||
$this->getMethod('appendEnd')->invokeArgs(null, array('中文測試真有趣!'))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user