public function testSetGetDate() { $v = new Verification('test'); $now = new DateTime(); $this->assertTrue($v->getDate() <= $now); $v = new Verification('test', $now); $this->assertTrue($v->getDate() == $now); $v = new Verification('test'); $v->setDate($now); $this->assertTrue($v->getDate() == $now); }
/** * 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; }