/** * Test the makeBatchSummary function. * * We want to ensure changing the method of obtaining status and payment_instrument * does not cause any regression. */ public function testMakeBatchSummary() { $batch = $this->callAPISuccess('Batch', 'create', array('title' => 'test', 'status_id' => 'Open', 'payment_instrument_id' => 'Cash')); $batchID = $batch['id']; $params = array('id' => $batchID); $makeBatchSummary = CRM_Financial_Page_AJAX::makeBatchSummary($batchID, $params); $this->assertEquals('Open', $makeBatchSummary['status']); $this->assertEquals('Cash', $makeBatchSummary['payment_instrument']); }
/** * Test the ajax function to get financial transactions. * * Test focus is on ensuring changes to how labels are retrieved does not cause regression. */ public function testGetFinancialTransactionsList() { $individualID = $this->individualCreate(); $this->contributionCreate($individualID); $batch = $this->callAPISuccess('Batch', 'create', array('title' => 'test', 'status_id' => 'Open')); CRM_Core_DAO::executeQuery("\n INSERT INTO civicrm_entity_batch (entity_table, entity_id, batch_id)\n values('civicrm_financial_trxn', 1, 1)\n "); $_REQUEST['sEcho'] = 1; $_REQUEST['entityID'] = $batch['id']; $json = CRM_Financial_Page_AJAX::getFinancialTransactionsList(TRUE); $this->assertEquals($json, '{"sEcho": 1, "iTotalRecords": 1, "iTotalDisplayRecords": 1, "aaData": [ ["","<a href=\\"/index.php?q=civicrm/profile/view&reset=1&gid=7&id=3&snippet=4\\" class=\\"crm-summary-link\\"><div' . ' class=\\"icon crm-icon Individual-icon\\"></div></a>","<a href=/index.php?q=civicrm/contact/view&reset=1&cid=3>Anderson, Anthony</a>","$ 100.00","12345","' . CRM_Utils_Date::customFormat(date('Ymd')) . ' 12:00 AM",' . '"Credit Card","Completed","Donation","<span><a href=\\"http://FIX ME/index.php?q=civicrm/contact/view/contribution&reset=1&id=1&cid=3&action=view&context=contribution&' . 'selectedChild=contribute\\" class=\\"action-item crm-hover-button\\" title=\'View Contribution\' >View</a></span>"]] }'); }