test: refactor CreditCardRulesTest

This commit is contained in:
kenjis 2024-06-20 09:31:56 +09:00
parent 967551970d
commit 59f1e29bee
No known key found for this signature in database
GPG Key ID: BD254878922AF198
2 changed files with 11 additions and 1210 deletions

File diff suppressed because it is too large Load Diff

View File

@ -22,12 +22,14 @@ use Tests\Support\Validation\TestRules;
/**
* @internal
*
* @no-final
*/
#[Group('Others')]
final class CreditCardRulesTest extends CIUnitTestCase
class CreditCardRulesTest extends CIUnitTestCase
{
private Validation $validation;
private array $config = [
protected Validation $validation;
protected array $config = [
'ruleSets' => [
Rules::class,
FormatRules::class,
@ -1204,7 +1206,7 @@ final class CreditCardRulesTest extends CIUnitTestCase
/**
* Generate a fake credit card number that still passes the Luhn algorithm.
*/
private static function generateCardNumber(int $prefix, int $length): string
protected static function generateCardNumber(int $prefix, int $length): string
{
$prefix = (string) $prefix;
$cursor = strlen($prefix);
@ -1221,7 +1223,7 @@ final class CreditCardRulesTest extends CIUnitTestCase
return implode('', $digits);
}
private static function calculateLuhnChecksum(array $digits, int $length): int
protected static function calculateLuhnChecksum(array $digits, int $length): int
{
$parity = $length % 2;