Include test (failing) to ensure api filters by status id.
authorSaurabh Batra <saurabh.batra96@gmail.com>
Wed, 2 Dec 2015 09:59:33 +0000 (15:29 +0530)
committerColeman Watts <coleman@civicrm.org>
Sat, 2 Jan 2016 01:20:06 +0000 (20:20 -0500)
Conflicts:
api/v3/Case.php

tests/phpunit/api/v3/CaseTest.php

index 14f8744c6939702fd0cdf7e390fc2af0de607ec4..6e929935b64c928c38480994e0a629ad8a497462 100644 (file)
@@ -373,4 +373,28 @@ class api_v3_CaseTest extends CiviCaseTestCase {
     $this->customGroupDelete($custom_ids['custom_group_id']);
   }
 
+  public function testCaseGetByStatus() {
+    // Create 2 cases with different status ids.
+    $case1 = $this->callAPISuccess('Case', 'create', array(
+      'contact_id' => 17,
+      'subject' => "Test case 1",
+      'case_type_id' => $this->caseTypeId,
+      'status_id' => "Open",
+      'sequential' => 1,
+    ));
+    $this->callAPISuccess('Case', 'create', array(
+      'contact_id' => 17,
+      'subject' => "Test case 2",
+      'case_type_id' => $this->caseTypeId,
+      'status_id' => "Urgent",
+      'sequential' => 1,
+    ));
+    $result = $this->callAPISuccessGetSingle('Case', array(
+      'sequential' => 1,
+      'contact_id' => 17,
+      'status_id' => "Open",
+    ));
+    $this->assertEquals($case1['id'], $result['id']);
+  }
+
 }