/** * @covers Intacct\Functions\AccountsPayable\BillLineCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <lineitem> <accountlabel>TestBill Account1</accountlabel> <offsetglaccountno>93590253</offsetglaccountno> <amount>76343.43</amount> <memo>Just another memo</memo> <locationid>Location1</locationid> <departmentid>Department1</departmentid> <item1099>true</item1099> <key>Key1</key> <totalpaid>23484.93</totalpaid> <totaldue>0</totaldue> <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> <billable>true</billable> </lineitem> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $line = new BillLineCreate(); $line->setAccountLabel('TestBill Account1'); $line->setOffsetGLAccountNumber('93590253'); $line->setTransactionAmount(76343.42999999999); $line->setMemo('Just another memo'); $line->setForm1099(true); $line->setKey('Key1'); $line->setTotalPaid(23484.93); $line->setTotalDue(0.0); $line->setBillable(true); $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\AccountsPayable\BillCreate::writeXml */ public function testParamOverrides() { $expected = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <function controlid="unittest"> <create_bill> <vendorid>VENDOR1</vendorid> <datecreated> <year>2015</year> <month>06</month> <day>30</day> </datecreated> <dateposted> <year>2015</year> <month>06</month> <day>30</day> </dateposted> <datedue> <year>2020</year> <month>09</month> <day>24</day> </datedue> <termname>N30</termname> <action>Submit</action> <batchkey>20323</batchkey> <billno>234</billno> <ponumber>234235</ponumber> <onhold>true</onhold> <description>Some description</description> <externalid>20394</externalid> <payto> <contactname>28952</contactname> </payto> <returnto> <contactname>289533</contactname> </returnto> <basecurr>USD</basecurr> <currency>USD</currency> <exchratedate> <year>2015</year> <month>06</month> <day>30</day> </exchratedate> <exchratetype>Intacct Daily Rate</exchratetype> <nogl>false</nogl> <supdocid>6942</supdocid> <customfields> <customfield> <customfieldname>customfield1</customfieldname> <customfieldvalue>customvalue1</customfieldvalue> </customfield> </customfields> <billitems> <lineitem> <glaccountno></glaccountno> <amount>76343.43</amount> </lineitem> </billitems> </create_bill> </function> EOF; $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->setIndentString(' '); $xml->startDocument(); $apBill = new BillCreate('unittest'); $apBill->setVendorId('VENDOR1'); $apBill->setTransactionDate(new DateType('2015-06-30')); $apBill->setGlPostingDate(new DateType('2015-06-30')); $apBill->setDueDate(new DateType('2020-09-24')); $apBill->setPaymentTerm('N30'); $apBill->setAction('Submit'); $apBill->setSummaryRecordNo(20323); $apBill->setBillNumber('234'); $apBill->setReferenceNumber('234235'); $apBill->setOnHold(true); $apBill->setDescription('Some description'); $apBill->setExternalId('20394'); $apBill->setPayToContactName('28952'); $apBill->setReturnToContactName('289533'); $apBill->setBaseCurrency('USD'); $apBill->setTransactionCurrency('USD'); $apBill->setExchangeRateDate(new DateType('2015-06-30')); $apBill->setExchangeRateType('Intacct Daily Rate'); $apBill->setDoNotPostToGL(false); $apBill->setAttachmentsId('6942'); $apBill->setCustomFields(['customfield1' => 'customvalue1']); $line1 = new BillLineCreate(); $line1->setTransactionAmount(76343.42999999999); $apBill->setLines([$line1]); $apBill->writeXml($xml); $this->assertXmlStringEqualsXmlString($expected, $xml->flush()); }