Ejemplo n.º 1
0
 /**
  * Add verification to SIE, verification MUST be balanced
  *
  * @param  Verification             $ver
  * @throws UnexpectedValueException If $ver is unbalanced
  * @throws OutOfBoundsException     If $ver date is out of bounds
  * @return SIE Instance for chaining
  */
 public function addVerification(Verification $ver)
 {
     // Verify that verification is balanced
     if (!$ver->isBalanced()) {
         throw new UnexpectedValueException("Verification <{$ver->getText()}> is not balanced");
     }
     // Verify that verification date matches accounting year
     if (isset($this->yearStart)) {
         $verdate = $ver->getDate();
         if ($verdate < $this->yearStart || $verdate > $this->yearStop) {
             $date = $verdate->format('Y-m-d');
             throw new OutOfBoundsException("Verification date <{$date}> is out of bounds");
         }
     }
     // Set names of used accounts
     foreach ($ver->getAccounts() as $account) {
         $nr = $account->getNumber();
         $this->usedAccounts[$nr] = $account;
     }
     // Save verification
     $this->verifications[] = $ver;
     return $this;
 }
Ejemplo n.º 2
0
 public function testSetGetText()
 {
     $v = new Verification();
     $v->setText('test');
     $this->assertEquals($v->getText(), 'test');
 }