/** * @covers Intacct\Functions\CashManagement\OtherReceiptLineCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <lineitem> <accountlabel>TestBill Account1</accountlabel> <amount>76343.43</amount> <memo>Just another memo</memo> <locationid>Location1</locationid> <departmentid>Department1</departmentid> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <projectid>Project1</projectid> <customerid>Customer1</customerid> <vendorid>Vendor1</vendorid> <employeeid>Employee1</employeeid> <itemid>Item1</itemid> <classid>Class1</classid> <contractid>Contract1</contractid> <warehouseid>Warehouse1</warehouseid> </lineitem> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $line = new OtherReceiptLineCreate(); $line->setAccountLabel('TestBill Account1'); $line->setTransactionAmount(76343.42999999999); $line->setMemo('Just another memo'); $line->setLocationId('Location1'); $line->setDepartmentId('Department1'); $line->setProjectId('Project1'); $line->setCustomerId('Customer1'); $line->setVendorId('Vendor1'); $line->setEmployeeId('Employee1'); $line->setItemId('Item1'); $line->setClassId('Class1'); $line->setContractId('Contract1'); $line->setWarehouseId('Warehouse1'); $line->setCustomFields(['customfield1' => 'customvalue1']); $line->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }
/** * @covers Intacct\Functions\CashManagement\OtherReceiptCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <record_otherreceipt> <paymentdate> <year>2015</year> <month>06</month> <day>30</day> </paymentdate> <payee>Costco</payee> <receiveddate> <year>2015</year> <month>07</month> <day>01</day> </receiveddate> <paymentmethod>Printed Check</paymentmethod> <bankaccountid>BA1234</bankaccountid> <depositdate> <year>2015</year> <month>07</month> <day>04</day> </depositdate> <refid>transno</refid> <description>my desc</description> <supdocid>A1234</supdocid> <currency>USD</currency> <exchratedate> <year>2015</year> <month>07</month> <day>04</day> </exchratedate> <exchratetype>Intacct Daily Rate</exchratetype> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <receiptitems> <lineitem> <glaccountno/> <amount>76343.43</amount> </lineitem> </receiptitems> </record_otherreceipt> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $record = new OtherReceiptCreate('unittest'); $record->setTransactionDate(new DateType('2015-06-30')); $record->setPayer('Costco'); $record->setReceiptDate(new DateType('2015-07-01')); $record->setPaymentMethod('Printed Check'); $record->setBankAccountId('BA1234'); $record->setDepositDate(new DateType('2015-07-04')); $record->setTransactionNo('transno'); $record->setDescription('my desc'); $record->setAttachmentsId('A1234'); $record->setTransactionCurrency('USD'); $record->setExchangeRateDate(new DateType('2015-07-04')); $record->setExchangeRateType('Intacct Daily Rate'); $record->setCustomFields(['customfield1' => 'customvalue1']); $line1 = new OtherReceiptLineCreate(); $line1->setTransactionAmount(76343.42999999999); $record->setLines([$line1]); $record->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }