From 63e9c3fda7a313515b3cade8819d2dcb43e8de3b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 15 Jan 2015 20:05:23 +1300 Subject: [PATCH] minor tidy ups --- CRM/Activity/BAO/Activity.php | 18 +++-- CRM/Contact/BAO/Contact.php | 3 +- .../CRM/Core/BAO/ActionScheduleTest.php | 3 +- .../phpunit/CRM/Utils/QueryFormatterTest.php | 76 ++++++++++++++----- .../phpunit/api/v3/SyntaxConformanceTest.php | 17 +++-- 5 files changed, 84 insertions(+), 33 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 4e39db2618..f8be953e9b 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -2097,7 +2097,6 @@ AND cl.modified_id = c.id * * @return string|bool * if file exists returns $activityTypeFile activity filename otherwise false. - * */ public static function getFileForActivityTypeId($activityTypeId, $crmDir = 'Activity') { $activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE); @@ -2203,7 +2202,7 @@ AND cl.modified_id = c.id } /** - * Get the allowed profile fields for Activities + * Get the allowed profile fields for Activities. * * @return array * array of activity profile Fields @@ -2239,8 +2238,10 @@ AND cl.modified_id = c.id } /** - * This function deletes the activity record related to contact record, - * when there are no target and assignee record w/ other contact. + * This function deletes the activity record related to contact record. + * + * This is conditional on there being no target and assignee record + * with other contacts. * * @param int $contactId * ContactId. @@ -2589,7 +2590,8 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } /** - * copy custom fields and attachments from an existing activity to another. + * Copy custom fields and attachments from an existing activity to another. + * * @see CRM_Case_Page_AJAX::_convertToCaseActivity() * * @param array $params @@ -2633,6 +2635,8 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } /** + * Get activity contact. + * * @param int $activityId * @param int $recordTypeID * @param string $column @@ -2667,6 +2671,10 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } /** + * Set api filter. + * + * @todo Document what this is for. + * * @param array $params */ public function setApiFilter(&$params) { diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index bdd35b0cd1..7c19e3dbf6 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -3164,7 +3164,6 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) * Array of all core or all custom table names extending civicrm_contact * @param string $contactRefColumn * 'contact_id' if processing core tables, 'entity_id' if processing custom tables - * @return void * * @link https://issues.civicrm.org/jira/browse/CRM-15602 * @see triggerInfo @@ -3292,7 +3291,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) * * @param string $fieldName * @param string $context - * @see CRM_Core_DAO::buildOptionsContext. + * @see CRM_Core_DAO::buildOptionsContext * @param array $props * whatever is known about this dao object. * diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 00218f5a6e..1626b45c71 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -32,6 +32,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Class CRM_Core_BAO_ActionScheduleTest */ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { + /** * @var object see CiviTest/CiviMailUtils */ @@ -56,7 +57,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'is_override' => 0, ); - $this->fixtures['rolling_membership_past'] = array(// createTestObject + $this->fixtures['rolling_membership_past'] = array( 'membership_type_id' => array( 'period_type' => 'rolling', 'duration_unit' => 'month', diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index fb8c9af054..3ab0ef0825 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -95,32 +95,32 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS, - '+*first* +*second*' + '+*first* +*second*', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, - '+first* +second*' + '+first* +second*', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_NONE, - 'first second' + 'first second', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_PHRASE, - '"first second"' + '"first second"', ); $cases[] = array( 'first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, - '"*first second*"' + '"*first second*"', ); $cases[] = array( 'first second', @@ -135,31 +135,71 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { 'first* second*', ); - // if user supplies wildcards, then ignore mode + // If user supplies wildcards, then ignore mode. foreach (array( CRM_Utils_QueryFormatter::MODE_NONE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, ) as $mode) { - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second'); - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second'); - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first* +second'); - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first* second'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first second%'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first second*'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first +second*'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first second*'); + $cases[] = array( + 'first% second', + CRM_Utils_QueryFormatter::LANG_SQL_LIKE, + $mode, + 'first% second', + ); + $cases[] = array( + 'first% second', + CRM_Utils_QueryFormatter::LANG_SQL_FTS, + $mode, + 'first* second', + ); + $cases[] = array( + 'first% second', + CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, + $mode, + '+first* +second', + ); + $cases[] = array( + 'first% second', + CRM_Utils_QueryFormatter::LANG_SOLR, + $mode, + 'first* second', + ); + $cases[] = array( + 'first second%', + CRM_Utils_QueryFormatter::LANG_SQL_LIKE, + $mode, + 'first second%', + ); + $cases[] = array( + 'first second%', + CRM_Utils_QueryFormatter::LANG_SQL_FTS, + $mode, + 'first second*', + ); + $cases[] = array( + 'first second%', + CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, + $mode, + '+first +second*', + ); + $cases[] = array( + 'first second%', + CRM_Utils_QueryFormatter::LANG_SOLR, + $mode, + 'first second*', + ); } return $cases; } /** - * @param $text - * @param $language - * @param $mode - * @param $expectedText + * @param string $text + * @param string $language + * @param string $mode + * @param string $expectedText * @dataProvider dataProvider */ public function testFormat($text, $language, $mode, $expectedText) { diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index d956242fa9..0380520e46 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -65,13 +65,16 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Survey' => 'CiviCampaign', ); - /* they are two types of missing APIs: - - Those that are to be implemented - (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ] - Those that don't exist - and that will never exist (eg an obsoleted Entity - they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped) - */ + /** + * Set up function. + * + * There are two types of missing APIs: + * Those that are to be implemented + * (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ] + * Those that don't exist + * and that will never exist (eg an obsoleted Entity + * they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped) + */ public function setUp() { parent::setUp(); $this->enableCiviCampaign(); -- 2.25.1