Add unit test for https://github.com/civicrm/civicrm-core/pull/13158
authoreileen <emcnaughton@wikimedia.org>
Thu, 28 Mar 2019 21:39:26 +0000 (10:39 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 28 Mar 2019 21:42:41 +0000 (10:42 +1300)
tests/phpunit/api/v3/ReportTemplateTest.php

index d328da7b1232109d53876f3aa4b8e96394133dba..c9e212e0a8a51c7161cab4d98bf3d4d96368b1ec 100644 (file)
@@ -1089,6 +1089,22 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * Test contact subtype filter on grant report.
+   */
+  public function testGrantReportSeparatedFilter() {
+    $contactID = $this->individualCreate(['contact_sub_type' => ['Student', 'Parent']]);
+    $contactID2 = $this->individualCreate();
+    $this->callAPISuccess('Grant', 'create', ['contact_id' => $contactID, 'status_id' => 1, 'grant_type_id' => 1, 'amount_total' => 1]);
+    $this->callAPISuccess('Grant', 'create', ['contact_id' => $contactID2, 'status_id' => 1, 'grant_type_id' => 1, 'amount_total' => 1]);
+    $rows = $this->callAPISuccess('report_template', 'getrows', [
+      'report_id' => 'grant/detail',
+      'contact_sub_type_op' => 'in',
+      'contact_sub_type_value' => ['Student'],
+    ]);
+    $this->assertEquals(1, $rows['count']);
+  }
+
   /**
    * Test PCP report to ensure total donors and total committed is accurate.
    */