From 3fc41a5d791f560f6d20012789ff95bf49623bb4 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 30 Nov 2019 11:57:51 +1300 Subject: [PATCH] Remove calls to deprecated pseudoconstant activityType, test --- CRM/Contact/BAO/Query.php | 7 +++---- tests/phpunit/CRM/Contact/BAO/QueryTest.php | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index e03d701574..60dd0f86f6 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -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') { diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index 282b0dc721..e3672739ee 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -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); + } + } -- 2.25.1