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:
71
vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php
vendored
Normal file
71
vendor/fzaninotto/faker/test/Faker/Calculator/LuhnTest.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Faker\Test\Calculator;
|
||||
|
||||
use Faker\Calculator\Luhn;
|
||||
|
||||
class LuhnTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function checkDigitProvider()
|
||||
{
|
||||
return array(
|
||||
array('7992739871', '3'),
|
||||
array('3852000002323', '7'),
|
||||
array('37144963539843', '1'),
|
||||
array('561059108101825', '0'),
|
||||
array('601100099013942', '4'),
|
||||
array('510510510510510', '0'),
|
||||
array(7992739871, '3'),
|
||||
array(3852000002323, '7'),
|
||||
array('37144963539843', '1'),
|
||||
array('561059108101825', '0'),
|
||||
array('601100099013942', '4'),
|
||||
array('510510510510510', '0')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider checkDigitProvider
|
||||
*/
|
||||
public function testComputeCheckDigit($partialNumber, $checkDigit)
|
||||
{
|
||||
$this->assertInternalType('string', $checkDigit);
|
||||
$this->assertEquals($checkDigit, Luhn::computeCheckDigit($partialNumber));
|
||||
}
|
||||
|
||||
public function validatorProvider()
|
||||
{
|
||||
return array(
|
||||
array('79927398710', false),
|
||||
array('79927398711', false),
|
||||
array('79927398712', false),
|
||||
array('79927398713', true),
|
||||
array('79927398714', false),
|
||||
array('79927398715', false),
|
||||
array('79927398716', false),
|
||||
array('79927398717', false),
|
||||
array('79927398718', false),
|
||||
array('79927398719', false),
|
||||
array(79927398713, true),
|
||||
array(79927398714, false),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validatorProvider
|
||||
*/
|
||||
public function testIsValid($number, $isValid)
|
||||
{
|
||||
$this->assertEquals($isValid, Luhn::isValid($number));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedExceptionMessage Argument should be an integer.
|
||||
*/
|
||||
public function testGenerateLuhnNumberWithInvalidPrefix()
|
||||
{
|
||||
Luhn::generateLuhnNumber('abc');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user