Remove calls to deprecated pseudoconstant activityType, test
authoreileen <emcnaughton@wikimedia.org>
Fri, 29 Nov 2019 22:57:51 +0000 (11:57 +1300)
committereileen <emcnaughton@wikimedia.org>
Fri, 29 Nov 2019 22:57:51 +0000 (11:57 +1300)
CRM/Contact/BAO/Query.php
tests/phpunit/CRM/Contact/BAO/QueryTest.php

index e03d70157438b54318ab6ca857e71c088b1aa18a..60dd0f86f6f3b25f75dac06f09c8d7df9cbfccee 100644 (file)
@@ -6189,10 +6189,9 @@ AND   displayRelType.is_active = 1
       return [CRM_Utils_Array::value($op, $qillOperators, $op), ''];
     }
 
-    if ($fieldName == 'activity_type_id') {
-      $pseudoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
-    }
-    elseif ($fieldName == 'country_id') {
+    // @todo - if the right BAO is passed in special handling for the below
+    // fields should not be required. testQillOptions.
+    if ($fieldName == 'country_id') {
       $pseudoOptions = CRM_Core_PseudoConstant::country();
     }
     elseif ($fieldName == 'county_id') {
index 282b0dc721351566aaf46b0f411147644bbf1684..e3672739ee61965c596494be9e7a4320f9aebd4c 100644 (file)
@@ -1080,4 +1080,15 @@ civicrm_relationship.is_active = 1 AND
     ]);
   }
 
+  /**
+   * Test the options are handled for the qill.
+   */
+  public function testQillOptions() {
+    $qill = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_BAO_Activity', 'activity_type_id', 2, '=');
+    $this->assertEquals(['=', 'Phone Call'], $qill);
+
+    $qill = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_BAO_Activity', 'priority_id', 2, '=');
+    $this->assertEquals(['=', 'Normal'], $qill);
+  }
+
 }