CRM-16188, added test for changes for commit https://github.com/JMAConsulting/civicrm...
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 26 Jan 2016 21:57:20 +0000 (03:27 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Tue, 26 Jan 2016 21:57:20 +0000 (03:27 +0530)
----------------------------------------
* CRM-16188: Create an order API
  https://issues.civicrm.org/jira/browse/CRM-16188

tests/phpunit/api/v3/OrderTest.php

index dc191b506c7535d2aa521b200633ee19b9f89d66..1e57ed095d6916106fad7aae30a6f84cb8e4f0ee 100644 (file)
@@ -63,7 +63,7 @@ class api_v3_OrderTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test Get Payment api.
+   * Test Get order api.
    */
   public function testGetOrder() {
     $contribution = $this->addOrder(FALSE, 100);
@@ -97,6 +97,25 @@ class api_v3_OrderTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * Test Get Order api for participant contribution.
+   */
+  public function testGetOrderParticipant() {
+    $contribution = $this->addOrder(FALSE, 100);
+    list($items, $contribution) = $this->createParticipantWithContribution();
+
+    $params = array(
+      'contribution_id' => $contribution['id'],
+    );
+
+    $order = $this->callAPISuccess('Order', 'get', $params);
+
+    $this->assertEquals(2, count($order['values'][$contribution['id']]['line_items']));
+    $this->callAPISuccess('Contribution', 'Delete', array(
+      'id' => $contribution['id'],
+    ));
+  }
+
   /**
    * Function to assert db values
    */