CRM-16259, fixed unit test
authorPradeep Nayak <pradpnayak@gmail.com>
Thu, 14 Jan 2016 09:37:03 +0000 (15:07 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Wed, 20 Jan 2016 21:31:40 +0000 (03:01 +0530)
----------------------------------------
* CRM-16259: Create Payment API
  https://issues.civicrm.org/jira/browse/CRM-16259

tests/phpunit/CRM/Contribute/BAO/ContributionTest.php

index 3257c89e90c7c3a806cd53f10344c0f90e91983b..d40e46e9144f484c1ab7faaf1e74b6852914de30 100644 (file)
@@ -660,10 +660,10 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     $queryParams[2] = array($toFinancialAccount, 'Integer');
 
     $dao = CRM_Core_DAO::executeQuery($query, $queryParams);
-    $amounts = array(1 => 50.00, 2 => 100.00);
+    $amounts = array(100.00, 50.00);
     while ($dao->fetch()) {
       $this->assertEquals(150.00, $dao->total_amount, 'Mismatch of total amount paid.');
-      $this->assertEquals($dao->amount, $amounts[$dao->entity_id], 'Mismatch of amount proportionally assigned to financial item');
+      $this->assertEquals($dao->amount, array_pop($amounts), 'Mismatch of amount proportionally assigned to financial item');
     }
 
     Contact::delete($this->_contactId);
@@ -697,8 +697,8 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     require_once 'CiviTest/Event.php';
     $this->_contactId = Contact::createIndividual();
     $this->_eventId = Event::create($this->_contactId);
-    $paramsSet['title'] = 'Price Set';
-    $paramsSet['name'] = CRM_Utils_String::titleToVar('Price Set');
+    $paramsSet['title'] = 'Price Set'. substr(sha1(rand()), 0, 4);
+    $paramsSet['name'] = CRM_Utils_String::titleToVar($paramsSet['title']);
     $paramsSet['is_active'] = TRUE;
     $paramsSet['financial_type_id'] = 4;
     $paramsSet['extends'] = 1;