From: Eileen McNaughton Date: Thu, 15 Jan 2015 07:14:52 +0000 (+1300) Subject: minor tidies X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=567b20767dd914e0650d4b5e35987a6542cdf8bb;p=civicrm-core.git minor tidies --- diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index f8be953e9b..1685e121ae 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -1187,7 +1187,8 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND $attachments = NULL, $cc = NULL, $bcc = NULL, - $contactIds, // FIXME a param with no default shouldn't be last + // FIXME a param with no default shouldn't be last + $contactIds, $additionalDetails = NULL ) { // get the contact details of logged in contact, which we set as from email @@ -2163,8 +2164,16 @@ AND cl.modified_id = c.id ); $Activityfields = array( - 'activity_type' => array('title' => ts('Activity Type'), 'name' => 'activity_type', 'type' => CRM_Utils_Type::T_STRING), - 'activity_status' => array('title' => ts('Activity Status'), 'name' => 'activity_status', 'type' => CRM_Utils_Type::T_STRING), + 'activity_type' => array( + 'title' => ts('Activity Type'), + 'name' => 'activity_type', + 'type' => CRM_Utils_Type::T_STRING, + ), + 'activity_status' => array( + 'title' => ts('Activity Status'), + 'name' => 'activity_status', + 'type' => CRM_Utils_Type::T_STRING, + ), ); $fields = array_merge($Activityfields, $exportableFields); } @@ -2288,7 +2297,7 @@ AND cl.modified_id = c.id } /** - * Does user has sufficient permission for view/edit activity record? + * Does user has sufficient permission for view/edit activity record. * * @param int $activityId * Activity record id. @@ -2656,6 +2665,8 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n } /** + * Get source contact id. + * * @param int $activityId * * @return null diff --git a/CRM/Admin/Form/Setting.php b/CRM/Admin/Form/Setting.php index 094d00ae6d..5aaf82f8b8 100644 --- a/CRM/Admin/Form/Setting.php +++ b/CRM/Admin/Form/Setting.php @@ -111,7 +111,7 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form { } /** - * Build the form object + * Build the form object. */ public function buildQuickForm() { $session = CRM_Core_Session::singleton(); diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 7c19e3dbf6..8e9ccee660 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2556,12 +2556,14 @@ AND civicrm_openid.is_primary = 1"; return CRM_Core_BAO_EntityTag::getContactTags($contactId, TRUE); case 'rel': + return CRM_Contact_BAO_Relationship::getRelationship($contactId, CRM_Contact_BAO_Relationship::CURRENT, 0, 1 ); case 'group': + return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, "Added", NULL, TRUE); case 'log': @@ -2617,7 +2619,7 @@ AND civicrm_openid.is_primary = 1"; } /** - * Process greetings and cache + * Process greetings and cache. * * @param object $contact * Contact object after save. @@ -3089,8 +3091,9 @@ AND civicrm_openid.is_primary = 1"; } /** - * Retrieve display name of contact that address is shared - * based on $masterAddressId or $contactId . + * Retrieve display name of contact that address is shared. + * + * This is based on $masterAddressId or $contactId . * * @param int $masterAddressId * Master id. @@ -3125,11 +3128,12 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) } /** - * Get the creation/modification times for a contact + * Get the creation/modification times for a contact. * * @param int $contactId * - * @return array('created_date' => $, 'modified_date' => $) + * @return array + * Dates - ('created_date' => $, 'modified_date' => $) */ public static function getTimestamps($contactId) { $timestamps = CRM_Core_DAO::executeQuery( @@ -3152,8 +3156,10 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id ) } /** - * Generate triggers to update the timestamp on the corresponding civicrm_contact row, - * on insert/update/delete to a table that extends civicrm_contact. + * Generate triggers to update the timestamp. + * + * The corresponding civicrm_contact row is updated on insert/update/delete + * to a table that extends civicrm_contact. * Don't regenerate triggers for all such tables if only asked for one table. * * @param array $info diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 1626b45c71..2baeca5192 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -36,7 +36,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** * @var object see CiviTest/CiviMailUtils */ - var $mut; + public $mut; public function setUp() { parent::setUp(); @@ -148,7 +148,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'start_action_unit' => 'day', 'subject' => '1-Day (repeating)', ); - $this->fixtures['sched_membership_join_2week'] = array(// create() + $this->fixtures['sched_membership_join_2week'] = array( 'name' => 'sched_membership_join_2week', 'title' => 'sched_membership_join_2week', 'absolute_date' => '', @@ -177,7 +177,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'start_action_unit' => 'week', 'subject' => 'subject sched_membership_join_2week', ); - $this->fixtures['sched_membership_end_2week'] = array(// create() + $this->fixtures['sched_membership_end_2week'] = array( 'name' => 'sched_membership_end_2week', 'title' => 'sched_membership_end_2week', 'absolute_date' => '', @@ -207,7 +207,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'subject' => 'subject sched_membership_end_2week', ); - $this->fixtures['sched_membership_end_2month'] = array(// create() + $this->fixtures['sched_membership_end_2month'] = array( 'name' => 'sched_membership_end_2month', 'title' => 'sched_membership_end_2month', 'absolute_date' => '', @@ -237,7 +237,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'subject' => 'subject sched_membership_end_2month', ); - $this->fixtures['sched_contact_bday_yesterday'] = array(// create() + $this->fixtures['sched_contact_bday_yesterday'] = array( 'name' => 'sched_contact_bday_yesterday', 'title' => 'sched_contact_bday_yesterday', 'absolute_date' => '', @@ -267,7 +267,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'subject' => 'subject sched_contact_bday_yesterday', ); - $this->fixtures['sched_contact_bday_anniv'] = array(// create() + $this->fixtures['sched_contact_bday_anniv'] = array( 'name' => 'sched_contact_bday_anniv', 'title' => 'sched_contact_bday_anniv', 'absolute_date' => '', @@ -297,7 +297,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'subject' => 'subject sched_contact_bday_anniv', ); - $this->fixtures['sched_contact_grad_tomorrow'] = array(// create() + $this->fixtures['sched_contact_grad_tomorrow'] = array( 'name' => 'sched_contact_grad_tomorrow', 'title' => 'sched_contact_grad_tomorrow', 'absolute_date' => '', @@ -326,7 +326,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'subject' => 'subject sched_contact_grad_tomorrow', ); - $this->fixtures['sched_contact_grad_anniv'] = array(// create() + $this->fixtures['sched_contact_grad_anniv'] = array( 'name' => 'sched_contact_grad_anniv', 'title' => 'sched_contact_grad_anniv', 'absolute_date' => '', @@ -354,7 +354,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'start_action_unit' => 'week', 'subject' => 'subject sched_contact_grad_anniv', ); - $this->fixtures['sched_membership_end_2month_repeat_twice_4_weeks'] = array(// create() + $this->fixtures['sched_membership_end_2month_repeat_twice_4_weeks'] = array( 'name' => 'sched_membership_end_2month', 'title' => 'sched_membership_end_2month', 'absolute_date' => '', @@ -383,7 +383,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'start_action_unit' => 'month', 'subject' => 'subject sched_membership_end_2month', ); - $this->fixtures['sched_membership_end_limit_to_none'] = array(// create() + $this->fixtures['sched_membership_end_limit_to_none'] = array( 'name' => 'limit to none', 'title' => 'limit to none', 'absolute_date' => '', @@ -446,15 +446,18 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $activityContact->save(); $this->assertCronRuns(array( - array(// Before the 24-hour mark, no email + array( + // Before the 24-hour mark, no email 'time' => '2012-06-14 04:00:00', 'recipients' => array(), ), - array(// After the 24-hour mark, an email + array( + // After the 24-hour mark, an email 'time' => '2012-06-14 15:00:00', 'recipients' => array(array('test-member@example.com')), ), - array(// Run cron again; message already sent + array( + // Run cron again; message already sent 'time' => '', 'recipients' => array(), ), @@ -477,19 +480,23 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $activityContact->save(); $this->assertCronRuns(array( - array(// Before the 24-hour mark, no email + array( + // Before the 24-hour mark, no email 'time' => '012-06-14 04:00:00', 'recipients' => array(), ), - array(// After the 24-hour mark, an email + array( + // After the 24-hour mark, an email 'time' => '2012-06-14 15:00:00', 'recipients' => array(array('test-member@example.com')), ), - array(// Run cron 4 hours later; first message already sent + array( + // Run cron 4 hours later; first message already sent 'time' => '2012-06-14 20:00:00', 'recipients' => array(), ), - array(// Run cron 6 hours later; send second message + array( + // Run cron 6 hours later; send second message. 'time' => '2012-06-14 21:00:01', 'recipients' => array(array('test-member@example.com')), ), @@ -524,11 +531,13 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { // start_date=2012-03-15 ; schedule is 2 weeks after start_date $this->assertCronRuns(array( - array(// Before the 2-week mark, no email + array( + // Before the 2-week mark, no email. 'time' => '2012-03-28 01:00:00', 'recipients' => array(), ), - array(// After the 2-week mark, send an email + array( + // After the 2-week mark, send an email. 'time' => '2012-03-29 01:00:00', 'recipients' => array(array('test-member@example.com')), ), @@ -558,7 +567,8 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { // start_date=2012-03-15 ; schedule is 2 weeks after start_date $this->assertCronRuns(array( - array(// After the 2-week mark, don't send email because we have different membership type + array( + // After the 2-week mark, don't send email because we have different membership type. 'time' => '2012-03-29 01:00:00', 'recipients' => array(), ), @@ -583,11 +593,13 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { // end_date=2012-06-15 ; schedule is 2 weeks before end_date $this->assertCronRuns(array( - array(// After the 2-week mark, send an email + array( + // After the 2-week mark, send an email. 'time' => '2012-08-15 01:00:00', 'recipients' => array(array('test-member@example.com')), ), - array(// After the 2-week mark, send an email + array( + // After the 2-week mark, send an email. 'time' => '2012-09-12 01:00:00', 'recipients' => array(array('test-member@example.com')), ), @@ -613,7 +625,8 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $this->callAPISuccess('action_schedule', 'create', $actionSchedule); // end_date=2012-06-15 ; schedule is 2 weeks before end_date $this->assertCronRuns(array( - array(// After the 2-week mark, send an email + array( + // After the 2-week mark, send an email. 'time' => '2012-08-15 01:00:00', 'recipients' => array(array('test-member@example.com')), ), diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index 3ab0ef0825..34967e5648 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -196,10 +196,13 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { } /** + * Test format. + * * @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 0380520e46..88c5b2411b 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -109,7 +109,12 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'LocationType', 'System', ); - $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting'); + $this->onlyIDNonZeroCount['get'] = array( + 'ActivityType', + 'Entity', + 'Domain', + 'Setting', + ); $this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant'); $this->deletableTestObjects = array(); } @@ -165,6 +170,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } /** + * Get entities for create tests. + * * @return array */ public static function entities_create() { @@ -233,6 +240,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } /** + * Get entities to be skipped on get tests. + * * @param bool $sequential * * @return array @@ -243,7 +252,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'MailingEventConfirm', 'MailingEventResubscribe', 'MailingEventUnsubscribe', - 'Location' + 'Location', ); if ($sequential === TRUE) { return $entitiesWithoutGet;