public function testYouCanGetNameOfJournal() { $this->assertEquals('Foo Bar', $this->sut->getName()->get()); }
/** * Write a Transaction to the Journal and update the Chart * * @param SplitTransaction $txn * @param Chart $chart * @param Journal $journal * * @return SplitTransaction Transaction with txn Id set * @throws AccountsException */ public function writeTransaction(SplitTransaction $txn, Chart $chart, Journal $journal) { return FFor::create()->txn(function () use($journal, $txn) { return $journal->write($txn); })->chart(function ($txn) use($chart) { $chart->getAccount($txn->getDrAc()[0])->debit($txn->getAmount()); $chart->getAccount($txn->getCrAc()[0])->credit($txn->getAmount()); })->fyield('txn'); }
/** * Update content of journal definition * * @param \DOMDocument $dom * @param Journal $journal * @return bool */ protected function updateJournalContent(\DOMDocument $dom, Journal $journal) { $xpath = new \DOMXPath($dom); $defNode = $xpath->query('/journal/definition')->item(0); $attributes = $defNode->attributes; $attributes->getNamedItem('name')->nodeValue = $journal->getName()->get(); $attributes->getNamedItem('crcy')->nodeValue = $journal->getCurrency()->getCode(); return $dom->save($this->journalPath->get()) !== false; }