From 37606d106b1b115184eca51503fc3bd141b23eb2 Mon Sep 17 00:00:00 2001 From: Saurabh Batra Date: Wed, 2 Dec 2015 15:29:33 +0530 Subject: [PATCH] Include test (failing) to ensure api filters by status id. Conflicts: api/v3/Case.php --- tests/phpunit/api/v3/CaseTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/phpunit/api/v3/CaseTest.php b/tests/phpunit/api/v3/CaseTest.php index 14f8744c69..6e929935b6 100644 --- a/tests/phpunit/api/v3/CaseTest.php +++ b/tests/phpunit/api/v3/CaseTest.php @@ -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']); + } + } -- 2.25.1