Esempio n. 1
0
 /**
  * Returns true if the account is valid for the current context.
  *
  * You have to have called isValidBank() before! If the current context
  * is no valid bank every account will validate to true.
  *
  * @param string $account
  * @see isValidBank()
  * @see Bank::isValid()
  * @throws InvalidContextException isValidBank() was not called before.
  * @return bool
  */
 public function isValidAccount($account)
 {
     if (!$this->initialized) {
         throw new InvalidContextException("You have to call isValidBank() before.");
     }
     // No valid bank makes every account valid
     if ($this->bank == null) {
         return true;
     }
     return $this->bank->isValid($account);
 }
Esempio n. 2
0
 /**
  * @param int $bankCode
  * @param int $account
  * @return bool
  * @throws BankNotFoundTestAPIException
  */
 protected function isValid(Bank $bank, $account)
 {
     try {
         return $bank->isValid($account);
     } catch (Exception $e) {
         echo $e->getMessage(), "\n", $e->getTraceAsString();
         exit(1);
     }
 }
Esempio n. 3
0
 /**
  * Validator::isValid() with an int should raise a warning.
  * 
  * @see Validator::isValid()
  * @dataProvider provideBanks
  * @expectedException PHPUnit_Framework_Error_Warning
  */
 public function testWarningForIsValidWithInt(Bank $bank)
 {
     $intAccount = 020012357;
     $bank->isValid($intAccount);
 }