public function testYouCanGetTheTransactionNote() { $this->assertInstanceOf('Chippyash\\Type\\String\\StringType', $this->sut->getNote()); }
/** * Write a transaction to store * * @param SplitTransaction $transaction * * @return IntType Transaction Unique Id * @throws \SAccounts\AccountsException */ public function writeTransaction(SplitTransaction $transaction) { if (!isset($this->journalName)) { throw new AccountsException('Missing Journal name'); } $dom = $this->getDom(); $xpath = new \DOMXPath($dom); $def = $xpath->query('/journal/definition')->item(0); $attribs = $def->attributes; $txnId = intval($attribs->getNamedItem('inc')->nodeValue) + 1; $attribs->getNamedItem('inc')->nodeValue = $txnId; $transactions = $xpath->query('/journal/transactions')->item(0); $newTxn = $dom->createElement('transaction'); $newTxn->setAttribute('id', $txnId); //NB - although we are looking for an ISO801 format to match xs:datetime //the W3C format actually matches xsd datetime. PHP ISO8601 does not $newTxn->setAttribute('date', $transaction->getDate()->format(\DateTime::W3C)); $newTxn->setAttribute('note', $transaction->getNote()->get()); $this->writeSplitFromTransaction($transaction, $dom, $newTxn); $transactions->appendChild($newTxn); $dom->save($this->journalPath->get()); return new IntType($txnId); }