/**
  * 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']);
 }
Example #2
0
 /**
  * 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&amp;reset=1&amp;gid=7&amp;id=3&amp;snippet=4\\" class=\\"crm-summary-link\\"><div' . ' class=\\"icon crm-icon Individual-icon\\"></div></a>","<a href=/index.php?q=civicrm/contact/view&amp;reset=1&amp;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&amp;reset=1&amp;id=1&amp;cid=3&amp;action=view&amp;context=contribution&amp;' . 'selectedChild=contribute\\" class=\\"action-item crm-hover-button\\" title=\'View Contribution\' >View</a></span>"]] }');
 }