From 2951dfd342481e49d8e4c19267aefe89fbd08f57 Mon Sep 17 00:00:00 2001 From: Alexandre Gomes Gaigalas Date: Mon, 13 Feb 2023 18:58:16 -0300 Subject: [PATCH] General fixes for PR#1392 (rupay card validation) --- CHANGELOG.md | 1 + library/Rules/CreditCard.php | 2 +- tests/unit/Rules/CreditCardTest.php | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 851e232e..12fcea3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Added ignores for phpstan template variables without getters. - Fixed misc phpstan and phpcs errors. - v::dateTime('z') is not supported anymore in PHP8, and should not be relied upon + - Added RuPay card validation (thanks @rakshit087) # Changes in Respect\Validation 1.0 diff --git a/library/Rules/CreditCard.php b/library/Rules/CreditCard.php index cb3294e0..03057d4a 100644 --- a/library/Rules/CreditCard.php +++ b/library/Rules/CreditCard.php @@ -103,4 +103,4 @@ final class CreditCard extends AbstractRule return preg_match(self::BRAND_REGEX_LIST[$this->brand], $input) > 0; } -} \ No newline at end of file +} diff --git a/tests/unit/Rules/CreditCardTest.php b/tests/unit/Rules/CreditCardTest.php index 3b9af2ea..8705ec30 100644 --- a/tests/unit/Rules/CreditCardTest.php +++ b/tests/unit/Rules/CreditCardTest.php @@ -35,7 +35,7 @@ final class CreditCardTest extends RuleTestCase public function itShouldThrowExceptionWhenCreditCardBrandIsNotValid(): void { $message = '"RespectCard" is not a valid credit card brand'; - $message .= ' (Available: Any, American Express, Diners Club, Discover, JCB, MasterCard, Visa)'; + $message .= ' (Available: Any, American Express, Diners Club, Discover, JCB, MasterCard, Visa, RuPay)'; $this->expectException(ComponentException::class); $this->expectExceptionMessage($message); @@ -108,4 +108,4 @@ final class CreditCardTest extends RuleTestCase [$jcb, '38520000023237'], // Diners Club ]; } -} \ No newline at end of file +}