예제 #1
0
 /**
  * Return true for known false positives.
  *
  * @return true
  */
 public function ignoreTestCase(Bank $bank, $account)
 {
     // http://sourceforge.net/p/kontocheck/bugs/11/
     if ($bank->getBankID() == "80063508") {
         return true;
     }
     // http://sourceforge.net/p/kontocheck/bugs/12/
     if ($bank->getValidationType() == "90") {
         return true;
     }
     return parent::ignoreTestCase($bank, $account);
 }
예제 #2
0
 /**
  * Return true for known false positives.
  *
  * Version 1.45 has many false positives.
  *
  * @return true
  */
 public function ignoreTestCase(Bank $bank, $account)
 {
     if ($account == 0) {
         return true;
     }
     /* In version 1.45 those do differ:
      *
      * bank: 28570092  method: 63  account: 5  bav: valid  kc: valid  ktoblzcheck: invalid
      * bank: 76026000  method: C7  account: 5  bav: valid  kc: valid  ktoblzcheck: invalid
      * bank: 30022000  method: 08  account: 5  bav: invalid  kc: invalid  ktoblzcheck: valid
      * bank: 80063508  method: 09  account: 30  bav: valid  ktoblzcheck: invalid
      * bank: 22230023  method: 68  account: 26  bav: invalid  kc: invalid  ktoblzcheck: valid
      * AccountNumberCheck::check: Specified method 'E1' is unknown
      * bank: 36050105  method: 78  account: 30  bav: invalid  kc: invalid  ktoblzcheck: valid
      */
     $falsePositives = array("63", "C7", "08", "09", "68", "E1", "78");
     if (in_array($bank->getValidationType(), array($falsePositives))) {
         return true;
     }
     return parent::ignoreTestCase($bank, $account);
 }
예제 #3
0
 /**
  * Builds a validator for a bank.
  *
  * @return Validator
  * @see Bank::getValidationType()
  * @see Bank::getValidator()
  */
 public function build(Bank $bank)
 {
     $class = sprintf('%s\\Validator%s', __NAMESPACE__, $bank->getValidationType());
     return new $class($bank);
 }
예제 #4
0
 /**
  * @param Bank $bank
  * @param String $account
  * @param array $results
  * @return String
  */
 private function getErrorMessage(Bank $bank, $account, array $results)
 {
     $resultTranslation = array(TestAPIResult::VALID => "valid", TestAPIResult::INVALID => "invalid", TestAPIResult::ERROR => "error");
     $message = "bank: {$bank->getBankID()}  method: {$bank->getValidationType()}  account: {$account}";
     foreach ($results as $result) {
         $message .= "  {$result->getTestAPI()->getName()}: " . $resultTranslation[$result->getResult()];
         if ($result instanceof TestAPIErrorResult) {
             $message .= " {$result->getMessage()}";
         }
     }
     return $message;
 }
예제 #5
0
 /**
  * 0 - 0000000000 should always be invalid
  *
  * @param String $validatorType
  * @throws ClassFileIOException
  * @throws MissingClassException
  * @dataProvider provideBanks
  */
 public function testNullIsInvalid(Bank $bank)
 {
     for ($length = 0; $length <= 10; $length++) {
         $account = str_pad("0", $length, "0", STR_PAD_LEFT);
         $this->assertFalse($bank->isValid($account), "{$bank->getBankID()}/{$bank->getValidationType()} {$account} should be invalid.");
     }
 }