CRM-21182 - Add test for fetching case fields in activity.get
authorColeman Watts <coleman@civicrm.org>
Thu, 14 Sep 2017 21:47:26 +0000 (17:47 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 14 Sep 2017 23:49:04 +0000 (19:49 -0400)
tests/phpunit/api/v3/ActivityCaseTest.php

index 9f8a2a31e990c1d8e3db15a261c388739aa9ed50..2a8187b0026abe575fe3c3ba2366f3d9f6a62b47 100644 (file)
@@ -77,4 +77,15 @@ class api_v3_ActivityCaseTest extends CiviCaseTestCase {
     $this->assertEquals(array(), array_intersect($getByCaseId_ids, $getByCaseNull_ids));
   }
 
+  public function testActivityGetWithCaseInfo() {
+    $activities = $this->callAPISuccess('Activity', 'get', array(
+      'sequential' => 1,
+      'case_id' => $this->_case['id'],
+      'return' => array('case_id', 'case_id.subject'),
+    ));
+    $this->assertEquals(__CLASS__, $activities['values'][0]['case_id.subject']);
+    // Note - case_id is always an array
+    $this->assertEquals($this->_case['id'], $activities['values'][0]['case_id'][0]);
+  }
+
 }