/** * Implements corresponding isValidXX logic. * * @param string $context Please see corresponding isValidXX description. * @param string $input Please see corresponding isValidXX description. * @param bool $allowNull Please see corresponding isValidXX description. * * @return does not return a value. * @throws ValidationException thrown if input is invalid. * @throws IntrusionException thrown if intrusion is detected. */ private function _assertValidCreditCard($context, $input, $allowNull) { $ccvr = new CreditCardValidationRule('CreditCard', $this->_encoder); $ccvr->setAllowNull($allowNull); $ccvr->assertValid($context, $input); return null; }
/** * isValid returns boolean values only */ function testCCVR_isValid() { $ccvr = new CreditCardValidationRule('CreditCardValidatorLuhn'); $this->assertTrue($ccvr->isValid('testCCVR_isValid', '0000000000000026')); $this->assertTrue($ccvr->isValid('testCCVR_isValid', '0000000000000034')); $this->assertFalse($ccvr->isValid('testCCVR_isValid', '0')); $this->assertFalse($ccvr->isValid('testCCVR_isValid', 'not a credit card number')); $this->assertFalse($ccvr->isValid('testCCVR_isValid', '0000-0000-0000-0001')); }