/**
     * @covers Intacct\Functions\GlobalConsolidations\WeightedAverageRateRead::writeXml
     */
    public function testDefaultParams()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <getWARate>
        <fromCurrency>USD</fromCurrency>
        <toCurrency>CAD</toCurrency>
        <fromDate>2016-06-01</fromDate>
        <toDate>2016-06-30</toDate>
    </getWARate>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $rate = new WeightedAverageRateRead('unittest');
        $rate->setFromCurrency('USD');
        $rate->setToCurrency('CAD');
        $rate->setFromDate(new DateType('2016-06-01'));
        $rate->setToDate(new DateType('2016-06-30'));
        $rate->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
    /**
     * @covers Intacct\Functions\Common\ReadByName::writeXml
     */
    public function testParamOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <readByName>
        <object>GLENTRY</object>
        <keys>987</keys>
        <fields>TRX_AMOUNT,RECORDNO,BATCHNO</fields>
        <returnFormat>xml</returnFormat>
        <docparid>Sales Invoice</docparid>
    </readByName>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $readByName = new ReadByName('unittest');
        $readByName->setObjectName('GLENTRY');
        $readByName->setNames(['987']);
        $readByName->setFields(['TRX_AMOUNT', 'RECORDNO', 'BATCHNO']);
        $readByName->setDocParId('Sales Invoice');
        $readByName->setReturnFormat('xml');
        $readByName->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
    /**
     * @covers Intacct\Functions\InventoryControl\TransactionItemDetail::writeXml
     *
     */
    public function testParamsOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<itemdetail>
    <quantity>15325</quantity>
    <serialno>S2355235</serialno>
    <aisle>55</aisle>
    <row>1</row>
    <bin>12</bin>
</itemdetail>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $itemDetail = new TransactionItemDetail();
        $itemDetail->setQuantity(15325);
        $itemDetail->setSerialNumber('S2355235');
        $itemDetail->setAisle('55');
        $itemDetail->setRow('1');
        $itemDetail->setBin('12');
        $itemDetail->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
    /**
     * @covers Intacct\Functions\Common\ReadByQuery::__construct
     * @covers Intacct\Functions\Common\ReadByQuery::writeXml
     */
    public function testParamOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <readByQuery>
        <object>CLASS</object>
        <query/>
        <fields>RECORDNO</fields>
        <pagesize>100</pagesize>
        <returnFormat>xml</returnFormat>
        <docparid>255252235</docparid>
    </readByQuery>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $readByQuery = new ReadByQuery('unittest');
        $readByQuery->setObjectName('CLASS');
        $readByQuery->setPageSize(100);
        $readByQuery->setReturnFormat('xml');
        $readByQuery->setFields(['RECORDNO']);
        $readByQuery->setDocParId('255252235');
        $readByQuery->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
 /**
  * @covers Intacct\Functions\Company\AttachmentsFolderDelete::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Attachments Folder Name is required for delete
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $record = new AttachmentsFolderDelete('unittest');
     $record->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\AccountsPayable\ApPaymentRequestSend::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Record No is required for send
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new ApPaymentRequestSend('unittest');
     $obj->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Company\DepartmentDelete::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Department ID is required for delete
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $classObj = new DepartmentDelete('unittest');
     $classObj->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\GeneralLedger\StatisticalJournalEntryDelete::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Record No is required for delete
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new StatisticalJournalEntryDelete('unittest');
     $obj->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\AccountsReceivable\ArAccountLabelDelete::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Account Label is required for delete
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new ArAccountLabelDelete('unittest');
     $obj->writeXml($xml);
 }
Example #10
0
 /**
  * @covers Intacct\Functions\Common\GetList\GetList::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Object Name is required for get_list
  */
 public function testNoFieldName()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $exp = new GetList();
     $exp->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\OrderEntry\OrderEntryTransactionDelete::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Document ID is required for delete
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new OrderEntryTransactionDelete('unittest');
     $obj->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\AccountsReceivable\PaymentServices\CustomerChargeCardDelete::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Record No is required for delete
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new CustomerChargeCardDelete('unittest');
     $obj->writeXml($xml);
 }
    /**
     * @covers Intacct\Functions\AccountsReceivable\ArAdjustmentLineCreate::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>
    <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>
    <warehouseid>Warehouse1</warehouseid>
</lineitem>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $line = new ArAdjustmentLineCreate();
        $line->setAccountLabel('TestBill Account1');
        $line->setOffsetGLAccountNumber('93590253');
        $line->setTransactionAmount(76343.42999999999);
        $line->setMemo('Just another memo');
        $line->setKey('Key1');
        $line->setTotalPaid(23484.93);
        $line->setTotalDue(0.0);
        $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->setWarehouseId('Warehouse1');
        $line->setCustomFields(['customfield1' => 'customvalue1']);
        $line->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
Example #14
0
 /**
  * @covers Intacct\Functions\Common\ReadMore::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Result ID is required for read more
  */
 public function testNoResultId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $readMore = new ReadMore('unittest');
     //$readMore->setResultId('6465763031VyprCMCoHYQAAGr@aRsAAAAU4');
     $readMore->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Company\AllocationUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Allocation ID is required for update
  */
 public function testRequiredId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $record = new AllocationUpdate('unittest');
     //$record->setAllocationId('SPLIT60-40');
     $record->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\EmployeeExpense\ExpenseReportReverse::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Reverse Date is required for reverse
  */
 public function testRequiredDate()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $record = new ExpenseReportReverse('unittest');
     $record->setRecordNo(1234);
     $record->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\PlatformServices\ApplicationInstall::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage XML Filename is required for install
  */
 public function testRequiredXmlFilename()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $app = new ApplicationInstall('unittest');
     //$app->setXmlFilename('app.xml');
     $app->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\InventoryControl\WarehouseUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Warehouse ID is required for update
  */
 public function testRequiredWarehouseId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $record = new WarehouseUpdate('unittest');
     //$record->setWarehouseId('W1234');
     $record->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\AccountsReceivable\ArPaymentSummaryCreate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage GL Posting Date is required for create
  */
 public function testMissingDate()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $record = new ArPaymentSummaryCreate('unittest');
     $record->setTitle('unit test');
     $record->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\AccountsReceivable\PaymentServices\CustomerChargeCardUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Record No is required for update
  */
 public function testRequiredRecordNo()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new CustomerChargeCardUpdate('unittest');
     //$obj->setRecordNo(1234);
     $obj->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Company\ClassUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Class ID is required for update
  */
 public function testRequiredClassId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $classObj = new ClassUpdate('unittest');
     //$classObj->setClassId('C1234');
     $classObj->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Projects\ProjectUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Project ID is required for update
  */
 public function testRequiredProjectId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $project = new ProjectUpdate('unittest');
     //$project->setProjectId('P1234');
     $project->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Company\ContactUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Contact Name is required for update
  */
 public function testRequiredClassId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $obj = new ContactUpdate('unittest');
     //$obj->setContactName('hello');
     $obj->writeXml($xml);
 }
    /**
     * @covers Intacct\Functions\Projects\TimesheetEntryCreate::writeXml
     */
    public function testParamOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<TIMESHEETENTRY>
    <ENTRYDATE>06/30/2016</ENTRYDATE>
    <QTY>1.75</QTY>
    <DESCRIPTION>desc</DESCRIPTION>
    <NOTES>my note</NOTES>
    <TASKKEY>1234</TASKKEY>
    <TIMETYPE>Salary</TIMETYPE>
    <BILLABLE>true</BILLABLE>
    <EXTBILLRATE>200</EXTBILLRATE>
    <EXTCOSTRATE>175</EXTCOSTRATE>
    <DEPARTMENTID>ADM</DEPARTMENTID>
    <LOCATIONID>100</LOCATIONID>
    <PROJECTID>P100</PROJECTID>
    <CUSTOMERID>C100</CUSTOMERID>
    <VENDORID>V100</VENDORID>
    <ITEMID>I100</ITEMID>
    <CLASSID>C200</CLASSID>
    <CONTRACTID>C300</CONTRACTID>
    <WAREHOUSEID>W100</WAREHOUSEID>
    <customfield1>customvalue1</customfield1>
</TIMESHEETENTRY>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $line = new TimesheetEntryCreate();
        $line->setEntryDate(new DateType('2016-06-30'));
        $line->setQuantity(1.75);
        $line->setDescription('desc');
        $line->setNotes('my note');
        $line->setTaskRecordNo(1234);
        $line->setTimeTypeName('Salary');
        $line->setBillable(true);
        $line->setOverrideBillingRate(200.0);
        $line->setOverrideLaborCostRate(175.0);
        $line->setDepartmentId('ADM');
        $line->setLocationId('100');
        $line->setProjectId('P100');
        $line->setCustomerId('C100');
        $line->setVendorId('V100');
        $line->setItemId('I100');
        $line->setClassId('C200');
        $line->setContractId('C300');
        $line->setWarehouseId('W100');
        $line->setCustomFields(['customfield1' => 'customvalue1']);
        $line->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
 /**
  * @covers Intacct\Functions\EmployeeExpense\EmployeeUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Employee ID is required for update
  */
 public function testRequiredProjectName()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $employee = new EmployeeUpdate('unittest');
     //$employee->setEmployeeId('E1234');
     $employee->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Company\AttachmentsFolderCreate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Attachments Folder Name is required for create
  */
 public function testRequiredFolder()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $record = new AttachmentsFolderCreate('unittest');
     //$record->setAttachmentFolderName('My Folder');
     $record->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\EmployeeExpense\EmployeeCreate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Contact Name is required for create
  */
 public function testRequiredProjectName()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $employee = new EmployeeCreate('unittest');
     //$employee->setContactName('john smith');
     $employee->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Projects\TaskUpdate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Task Record No is required for update
  */
 public function testRequiredTaskName()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $task = new TaskUpdate('unittest');
     //$task->setRecordNo(10);
     $task->setProjectId('P1234');
     $task->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\Company\DepartmentCreate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Department Name is required for create
  */
 public function testRequiredDepartmentName()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $department = new DepartmentCreate('unittest');
     $department->setDepartmentId('D1234');
     //$department->setDepartmentName('hello world');
     $department->writeXml($xml);
 }
 /**
  * @covers Intacct\Functions\AccountsReceivable\ArPaymentApply::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Received Date is required for apply
  */
 public function testRequiredCustomerId()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $payment = new ArPaymentApply('unittest');
     $payment->setRecordNo(1234);
     //$payment->setReceivedDate(new DateType('2016-06-30'));
     $payment->writeXml($xml);
 }