From a65f0d2f1ea396a41e9d14ac5d919d2fe32ff0fd Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 31 Jan 2014 18:13:50 +1300 Subject: [PATCH] Unit test on group selector AJAX call - add ability to return result for unit test --- CRM/Group/Page/AJAX.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php index 99ef1cac4a..5f09b0edd7 100644 --- a/CRM/Group/Page/AJAX.php +++ b/CRM/Group/Page/AJAX.php @@ -91,7 +91,12 @@ class CRM_Group_Page_AJAX { if (empty($params['showOrgInfo'])) { unset($selectorElements[6]); } - + //add setting so this can be tested by unit test + //@todo - ideally the portion of this that retrieves the groups should be extracted into a function separate + // from the one which deals with web inputs & outputs so we have a properly testable & re-usable function + if(!empty($params['is_unit_test'])) { + return array($groups, $iFilteredTotal); + } echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements); CRM_Utils_System::civiExit(); } -- 2.25.1