public function isValid($value)
 {
     $messages = [];
     $result = true;
     $validator = new ZendCreditCard();
     if (!$validator->isValid($value)) {
         $result = false;
         $messages[] = 'Must be a valid credit card';
     }
     return new ValidatorResult($result, $messages);
 }
Exemple #2
0
 /**
  * @group ZF-9477
  */
 public function testMultiInstitute()
 {
     $validator = new Validator\CreditCard(array('type' => Validator\CreditCard::MASTERCARD));
     $this->assertFalse($validator->isValid('4111111111111111'));
     $message = $validator->getMessages();
     $this->assertContains('not from an allowed institute', current($message));
 }