From 8d7a9d07300f31c5ae3b25188e27a1d8711654cd Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Tue, 20 Jan 2015 13:42:53 +1300 Subject: [PATCH] Coding standards cleanup sprint. See https://pad.riseup.net/p/QOOHQpetSXXo This is batch 12. --- CRM/Activity/Page/Tab.php | 2 +- CRM/Activity/Selector/Activity.php | 12 +- CRM/Admin/Form/MessageTemplates.php | 4 +- CRM/Admin/Form/Options.php | 12 +- CRM/Campaign/BAO/Survey.php | 32 ++- CRM/Campaign/Form/Petition/Signature.php | 23 +- CRM/Case/Form/CaseView.php | 4 +- CRM/Case/Selector/Search.php | 5 +- .../Form/Search/Custom/ContribSYBNT.php | 3 +- CRM/Contact/Form/Search/Custom/Sample.php | 5 +- CRM/Contact/Form/Task/Merge.php | 3 +- CRM/Contribute/Selector/Search.php | 45 ++-- CRM/Core/BAO/CustomValue.php | 2 +- CRM/Core/BAO/EntityTag.php | 14 +- CRM/Core/BAO/OpenID.php | 2 +- CRM/Core/BAO/SchemaHandler.php | 16 +- CRM/Core/CodeGen/Config.php | 5 +- CRM/Core/Config.php | 14 +- CRM/Core/Form/Date.php | 140 ++++++------ CRM/Core/OptionValue.php | 15 +- CRM/Core/Page.php | 18 +- CRM/Core/Payment/PayPalIPN.php | 2 +- CRM/Core/PseudoConstant.php | 12 +- CRM/Core/Resources.php | 111 +++++----- CRM/Custom/Page/Field.php | 6 - CRM/Event/Import/Parser.php | 4 +- CRM/Event/Page/EventInfo.php | 2 +- CRM/Grant/Form/Search.php | 4 +- CRM/Mailing/Event/BAO/Subscribe.php | 2 +- CRM/SMS/Form/Schedule.php | 6 +- CRM/Utils/DeprecatedUtils.php | 2 +- tests/phpunit/CRM/Case/AllTests.php | 2 +- .../CRM/Core/BAO/CustomValueTableTest.php | 12 +- .../WebTest/Admin/MoveCustomDataTest.php | 14 +- .../Contact/CreateCmsUserFromContactTest.php | 29 ++- .../WebTest/Event/AddParticipationTest.php | 43 +++- .../phpunit/WebTest/Import/DateFormatTest.php | 24 +-- .../Import/MultipleRelationshipTest.php | 200 +++++++++--------- .../WebTest/Profile/ProfileCountryState.php | 2 +- tests/phpunit/api/v3/EmailTest.php | 4 +- tests/phpunit/api/v3/GroupNestingTest.php | 2 +- tests/phpunit/api/v3/MembershipTypeTest.php | 72 ++++--- tests/phpunit/api/v3/OptionGroupTest.php | 22 +- tests/qunit/example/test.js | 8 +- 44 files changed, 473 insertions(+), 488 deletions(-) diff --git a/CRM/Activity/Page/Tab.php b/CRM/Activity/Page/Tab.php index 6686de71d0..7bca746704 100644 --- a/CRM/Activity/Page/Tab.php +++ b/CRM/Activity/Page/Tab.php @@ -204,7 +204,7 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page { if (in_array($activityTypeId, array( $emailTypeValue, - $letterTypeValue + $letterTypeValue, ))) { return; } diff --git a/CRM/Activity/Selector/Activity.php b/CRM/Activity/Selector/Activity.php index 4187319007..9623906d93 100644 --- a/CRM/Activity/Selector/Activity.php +++ b/CRM/Activity/Selector/Activity.php @@ -75,7 +75,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C * * @return \CRM_Activity_Selector_Activity */ - function __construct( + public function __construct( $contactId, $permission, $admin = FALSE, @@ -221,7 +221,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C 'url' => $url, 'qs' => $qsView, 'title' => ts('View Activity'), - ) + ), ); } @@ -241,7 +241,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C 'url' => $updateUrl, 'qs' => $qsUpdate, 'title' => ts('Update Activity'), - ) + ), ); } } @@ -257,7 +257,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C 'url' => '#', 'extra' => 'onclick="javascript:fileOnCase( \'file\', \'%%id%%\', null, this ); return false;"', 'title' => ts('File on Case'), - ) + ), ); } @@ -272,7 +272,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C 'url' => $delUrl, 'qs' => $qsDelete, 'title' => ts('Delete Activity'), - ) + ), ); } @@ -284,7 +284,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C 'url' => 'civicrm/mailing/report', 'qs' => "mid={$sourceRecordId}&reset=1&cid=%%cid%%&context=activitySelector", 'title' => ts('View Mailing Report'), - ) + ), ); } diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index 0f24a14b88..840028de0d 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -144,7 +144,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { 'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates', 'action=browse&reset=1' ), - ) + ), ); CRM_Utils_System::appendBreadCrumb($breadCrumb); @@ -188,7 +188,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { $this->add('select', 'pdf_format_id', ts('PDF Page Format'), array( - 'null' => ts('- default -') + 'null' => ts('- default -'), ) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE ); diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index 375e91bac2..881fd8931e 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -95,7 +95,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { $scriptURL = "" . ts('Learn more about a script that can automatically update contact addressee and greeting options.') . ""; CRM_Core_Session::setStatus(ts('The selected %1 option has not been deleted because it is currently in use. Please update these contacts to use a different format before deleting this option. %2', array( 1 => $this->_gLabel, - 2 => $scriptURL + 2 => $scriptURL, )), ts('Sorry'), 'error'); $redirect = CRM_Utils_System::url($url, $params); CRM_Utils_System::redirect($redirect); @@ -132,7 +132,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { if (in_array($this->_gName, array( 'email_greeting', 'postal_greeting', - 'addressee' + 'addressee', ))) { $defaults['contactOptions'] = (CRM_Utils_Array::value('filter', $defaults)) ? $defaults['filter'] : NULL; } @@ -173,7 +173,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { if (!in_array($this->_gName, array( 'email_greeting', 'postal_greeting', - 'addressee' + 'addressee', )) && !$isReserved ) { $this->addRule('label', @@ -304,7 +304,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { if (in_array($this->_gName, array( 'email_greeting', 'postal_greeting', - 'addressee' + 'addressee', )) && !$isReserved ) { $values = array( @@ -352,7 +352,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { if (in_array($self->_gName, array( 'email_greeting', 'postal_greeting', - 'addressee' + 'addressee', )) && empty($self->_defaultValues['is_reserved']) ) { $label = $fields['label']; @@ -455,7 +455,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array( 1 => $this->_gLabel, - 2 => $optionValue->label + 2 => $optionValue->label, )), ts('Saved'), 'success'); } } diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index 96661f31b2..ed45ec00fb 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -306,14 +306,9 @@ SELECT survey.id as id, } /** - * Get Surveys activity types - * - * + * Get Survey activity types. */ - static function getSurveyActivityType( - $returnColumn = 'label', - $includePetitionActivityType = FALSE - ) { + public static function getSurveyActivityType($returnColumn = 'label', $includePetitionActivityType = FALSE) { static $activityTypes; $cacheKey = "{$returnColumn}_{$includePetitionActivityType}"; @@ -449,7 +444,7 @@ SELECT survey.id as id, foreach ($returnProperties as $property => $ignore) { $value = (in_array($property, array( 'city', - 'street_address' + 'street_address', ))) ? 'address' : $property; switch ($property) { case 'sort_name': @@ -522,9 +517,7 @@ Group By contact.id"; * @return array * array of survey activity. */ - static function voterActivityDetails( - $surveyId, $voterIds, $interviewerId = NULL, - $statusIds = array()) { + public static function voterActivityDetails($surveyId, $voterIds, $interviewerId = NULL, $statusIds = array()) { $activityDetails = array(); if (!$surveyId || !is_array($voterIds) || empty($voterIds) @@ -585,7 +578,7 @@ INNER JOIN civicrm_activity_contact activityAssignment * @return array * An array of survey activity. */ - static function getSurveyActivities( + public static function getSurveyActivities( $surveyId, $interviewerId = NULL, $statusIds = NULL, @@ -742,7 +735,7 @@ INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a * * @param int $activityId * Activity id. - * @return boolean + * @return bool */ public static function isSurveyActivity($activityId) { $isSurveyActivity = FALSE; @@ -840,13 +833,12 @@ INNER JOIN civicrm_contact contact_a ON ( activityTarget.contact_id = contact_a if (CRM_Core_Permission::check('access CiviReport')) { $reportID = self::getReportID($surveyId); if ($reportID) { - $voterLinks['report'] = - array( - 'name' => 'report', - 'url' => "civicrm/report/instance/{$reportID}", - 'qs' => 'reset=1', - 'title' => ts('View Survey Report'), - ); + $voterLinks['report'] = array( + 'name' => 'report', + 'url' => "civicrm/report/instance/{$reportID}", + 'qs' => 'reset=1', + 'title' => ts('View Survey Report'), + ); } } diff --git a/CRM/Campaign/Form/Petition/Signature.php b/CRM/Campaign/Form/Petition/Signature.php index 1fe046fcad..a4ee3f0d0c 100644 --- a/CRM/Campaign/Form/Petition/Signature.php +++ b/CRM/Campaign/Form/Petition/Signature.php @@ -221,7 +221,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { CRM_Core_Error::fatal('The contact profile needs to contain the primary email address field'); } - $ufJoinParams['weight'] = 1; $this->_activityProfileId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams); @@ -326,7 +325,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { * @return void * @see valid_date */ - public static function formRule($fields, $files, $errors) { $errors = array(); @@ -344,7 +342,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { 'tag_unconfirmed' ); - if ($tag_name) { // Check if contact 'email confirmed' tag exists, else create one // This should be in the petition module initialise code to create a default tag for this @@ -496,7 +493,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { break; } - $transaction = new CRM_Core_Transaction(); $addToGroupID = isset($this->_addToGroupID) ? $this->_addToGroupID : NULL; @@ -570,11 +566,10 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { $this->postProcessHook(); // set the template to thank you - $url = - CRM_Utils_System::url( - 'civicrm/petition/thankyou', - 'pid=' . $this->_surveyId . '&id=' . $this->_sendEmailMode . '&reset=1' - ); + $url = CRM_Utils_System::url( + 'civicrm/petition/thankyou', + 'pid=' . $this->_surveyId . '&id=' . $this->_sendEmailMode . '&reset=1' + ); CRM_Utils_System::redirect($url); } } @@ -608,16 +603,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form { } if ($fields) { - /* - // unset any email-* fields since we already collect it, CRM-2888 - foreach ( array_keys( $fields ) as $fieldName ) { - if ( substr( $fieldName, 0, 6 ) == 'email-' ) { - unset( $fields[$fieldName] ); - } - } - */ - - $this->assign($name, $fields); $addCaptcha = FALSE; diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index 94e4978c53..41368eeb27 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -170,7 +170,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { if ($relatedCases) { $this->assign('relatedCaseLabel', ts('%1 Related Case', array( 'count' => count($relatedCases), - 'plural' => '%1 Related Cases' + 'plural' => '%1 Related Cases', ))); $this->assign('relatedCaseUrl', CRM_Utils_System::url('civicrm/contact/view/case', array( 'id' => $this->_caseID, @@ -312,7 +312,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { $this->add('select', 'merge_case_id', ts('Select Case for Merge'), array( - '' => ts('- select case -') + '' => ts('- select case -'), ) + $otherCases, FALSE, array('class' => 'crm-select2 huge') diff --git a/CRM/Case/Selector/Search.php b/CRM/Case/Selector/Search.php index 2320e1ff21..30717d1886 100644 --- a/CRM/Case/Selector/Search.php +++ b/CRM/Case/Selector/Search.php @@ -141,7 +141,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { * * @return \CRM_Case_Selector_Search */ - function __construct( + public function __construct( &$queryParams, $action = CRM_Core_Action::NONE, $additionalClause = NULL, @@ -185,8 +185,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { * * @return array */ - static - public function &links($isDeleted = FALSE, $key = NULL) { + static public function &links($isDeleted = FALSE, $key = NULL) { $extraParams = ($key) ? "&key={$key}" : NULL; if ($isDeleted) { diff --git a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php index 79ca97a975..4283f2c10a 100644 --- a/CRM/Contact/Form/Search/Custom/ContribSYBNT.php +++ b/CRM/Contact/Form/Search/Custom/ContribSYBNT.php @@ -144,7 +144,7 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT implements CRM_Contact_Form_Se * * @return string */ - function all( + public function all( $offset = 0, $rowcount = 0, $sort = NULL, @@ -191,7 +191,6 @@ GROUP BY contact_a.id ORDER BY donation_amount desc "; - if ($justIDs) { CRM_Core_DAO::executeQuery("DROP TEMPORARY TABLE IF EXISTS CustomSearch_SYBNT_temp"); $query = "CREATE TEMPORARY TABLE CustomSearch_SYBNT_temp AS ({$sql})"; diff --git a/CRM/Contact/Form/Search/Custom/Sample.php b/CRM/Contact/Form/Search/Custom/Sample.php index 627a749139..0917cefe05 100644 --- a/CRM/Contact/Form/Search/Custom/Sample.php +++ b/CRM/Contact/Form/Search/Custom/Sample.php @@ -106,10 +106,7 @@ class CRM_Contact_Form_Search_Custom_Sample extends CRM_Contact_Form_Search_Cust * * @return string */ - function all( - $offset = 0, $rowcount = 0, $sort = NULL, - $includeContactIDs = FALSE, $justIDs = FALSE - ) { + public function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) { if ($justIDs) { $selectClause = "contact_a.id as contact_id"; $sort = 'contact_a.id'; diff --git a/CRM/Contact/Form/Task/Merge.php b/CRM/Contact/Form/Task/Merge.php index c8099dce4d..418b8e35b7 100644 --- a/CRM/Contact/Form/Task/Merge.php +++ b/CRM/Contact/Form/Task/Merge.php @@ -62,8 +62,9 @@ class CRM_Contact_Form_Task_Merge extends CRM_Contact_Form_Task { $contact = CRM_Core_DAO::executeQuery($sql); while ($contact->fetch()) { $contactTypes[$contact->contact_type] = TRUE; - if (count($contactTypes) > 1) + if (count($contactTypes) > 1) { break; + } } if (count($contactTypes) > 1) { $statusMsg = ts('Selected records must all be the same contact type (i.e. all Individuals).'); diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 3da2901603..b4d45e5d26 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -163,7 +163,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C * * @return \CRM_Contribute_Selector_Search */ - function __construct( + public function __construct( &$queryParams, $action = CRM_Core_Action::NONE, $contributionClause = NULL, @@ -451,8 +451,8 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C ), ); if ($this->_includeSoftCredits) { - self::$_columnHeaders = - array_merge( + self::$_columnHeaders + = array_merge( self::$_columnHeaders, array( array( @@ -463,8 +463,8 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C ) ); } - self::$_columnHeaders = - array_merge( + self::$_columnHeaders + = array_merge( self::$_columnHeaders, array( array( @@ -511,25 +511,25 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C self::$_columnHeaders = array_merge($pre, self::$_columnHeaders); } if ($this->_includeSoftCredits) { - self::$_columnHeaders = - array_merge( - self::$_columnHeaders, + self::$_columnHeaders + = array_merge( + self::$_columnHeaders, + array( array( - array( - 'name' => ts('Soft Credit For'), - 'sort' => 'contribution_soft_credit_name', - 'direction' => CRM_Utils_Sort::DONTCARE, - ), - array( - 'name' => ts('Soft Credit Type'), - 'sort' => 'contribution_soft_credit_type', - 'direction' => CRM_Utils_Sort::ASCENDING, - ), - ) - ); + 'name' => ts('Soft Credit For'), + 'sort' => 'contribution_soft_credit_name', + 'direction' => CRM_Utils_Sort::DONTCARE, + ), + array( + 'name' => ts('Soft Credit Type'), + 'sort' => 'contribution_soft_credit_type', + 'direction' => CRM_Utils_Sort::ASCENDING, + ), + ) + ); } - self::$_columnHeaders = - array_merge( + self::$_columnHeaders + = array_merge( self::$_columnHeaders, array( array('desc' => ts('Actions')), ) @@ -571,4 +571,3 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C return $this->_query->summaryContribution($this->_context); } } - diff --git a/CRM/Core/BAO/CustomValue.php b/CRM/Core/BAO/CustomValue.php index 156b962203..98914b549d 100644 --- a/CRM/Core/BAO/CustomValue.php +++ b/CRM/Core/BAO/CustomValue.php @@ -47,7 +47,7 @@ class CRM_Core_BAO_CustomValue extends CRM_Core_DAO { * @param string $value * The data to be validated. * - * @return boolean + * @return bool * True if the value is of the specified type */ public static function typecheck($type, $value) { diff --git a/CRM/Core/BAO/EntityTag.php b/CRM/Core/BAO/EntityTag.php index c0ef14f1f3..88561556d5 100644 --- a/CRM/Core/BAO/EntityTag.php +++ b/CRM/Core/BAO/EntityTag.php @@ -45,8 +45,8 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag { * @param string $entityTable * Name of the entity table usually 'civicrm_contact'. * - * @return array( - * ) reference $tag array of category id's the contact belongs to. + * @return array + * reference $tag array of category id's the contact belongs to. * */ public static function &getTag($entityID, $entityTable = 'civicrm_contact') { @@ -103,7 +103,7 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag { * @param array $params * An assoc array of name/value pairs. * - * @return boolean + * @return bool */ public static function dataExists($params) { return !($params['tag_id'] == 0); @@ -114,8 +114,6 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag { * * @param array $params * (reference ) an assoc array of name/value pairs. - * - * @return CRM_Core_BAO_EntityTag */ public static function del(&$params) { $entityTag = new CRM_Core_BAO_EntityTag(); @@ -390,15 +388,17 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag { /** * Get options for a given field. + * * @see CRM_Core_DAO::buildOptions + * @see CRM_Core_DAO::buildOptionsContext * * @param string $fieldName * @param string $context - * @see CRM_Core_DAO::buildOptionsContext. + * As per CRM_Core_DAO::buildOptionsContext. * @param array $props * whatever is known about this dao object. * - * @return Array|bool + * @return array|bool */ public static function buildOptions($fieldName, $context = NULL, $props = array()) { $params = array(); diff --git a/CRM/Core/BAO/OpenID.php b/CRM/Core/BAO/OpenID.php index 73eca2856c..5960974bda 100644 --- a/CRM/Core/BAO/OpenID.php +++ b/CRM/Core/BAO/OpenID.php @@ -78,7 +78,7 @@ class CRM_Core_BAO_OpenID extends CRM_Core_DAO_OpenID { * @param string $identity_url * The OpenID to check. * - * @return boolean + * @return bool */ public static function isAllowedToLogin($identity_url) { $openId = new CRM_Core_DAO_OpenID(); diff --git a/CRM/Core/BAO/SchemaHandler.php b/CRM/Core/BAO/SchemaHandler.php index 5e0e52eea2..04875b81fd 100644 --- a/CRM/Core/BAO/SchemaHandler.php +++ b/CRM/Core/BAO/SchemaHandler.php @@ -79,7 +79,7 @@ class CRM_Core_BAO_SchemaHandler { $config = CRM_Core_Config::singleton(); if ($config->logging) { // logging support - $logging = new CRM_Logging_Schema; + $logging = new CRM_Logging_Schema(); $logging->fixSchemaDifferencesFor($params['name'], NULL, FALSE); } @@ -348,7 +348,7 @@ ALTER TABLE {$tableName} if ($config->logging) { // logging support: if we’re adding a column (but only then!) make sure the potential relevant log table gets a column as well if ($params['operation'] == 'add') { - $logging = new CRM_Logging_Schema; + $logging = new CRM_Logging_Schema(); $logging->fixSchemaDifferencesFor($params['table_name'], array('ADD' => array($params['name'])), FALSE); } } @@ -361,14 +361,10 @@ ALTER TABLE {$tableName} } /** - * Delete a civiCRM-table + * Delete a CiviCRM-table * * @param string $tableName * Name of the table to be created. - * - * @return bool - * TRUE if successfully deleted, FALSE otherwise. - * */ public static function dropTable($tableName) { $sql = "DROP TABLE $tableName"; @@ -410,7 +406,7 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )"; public static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array()) { $queries = array(); require_once 'CRM/Core/DAO/Domain.php'; - $domain = new CRM_Core_DAO_Domain; + $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales); @@ -440,7 +436,7 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )"; "index_{$field}{$lengthName}", "FK_{$table}_{$field}{$lengthName}", "UI_{$field}{$lengthName}", - "{$createIndexPrefix}_{$field}{$lengthName}" + "{$createIndexPrefix}_{$field}{$lengthName}", ); // skip to the next $field if one of the above $names exists; handle multilingual for CRM-4126 @@ -465,7 +461,7 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )"; } // run the queries without i18n-rewriting - $dao = new CRM_Core_DAO; + $dao = new CRM_Core_DAO(); foreach ($queries as $query) { $dao->query($query, FALSE); } diff --git a/CRM/Core/CodeGen/Config.php b/CRM/Core/CodeGen/Config.php index 2f0627a195..dfa58413d2 100644 --- a/CRM/Core/CodeGen/Config.php +++ b/CRM/Core/CodeGen/Config.php @@ -18,9 +18,8 @@ class CRM_Core_CodeGen_Config extends CRM_Core_CodeGen_BaseTask { if (!in_array($this->config->cms, array( 'drupal', 'joomla', - 'wordpress' - )) - ) { + 'wordpress', + ))) { echo "Config file for '{$this->config->cms}' not known."; exit(); } diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index 984d4dbd3f..6abd64a050 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -211,7 +211,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { self::$_singleton = $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID()); // if not in cache, fire off config construction if (!self::$_singleton) { - self::$_singleton = new CRM_Core_Config; + self::$_singleton = new CRM_Core_Config(); self::$_singleton->_initialize($loadFromDB); //initialize variables. for gencode we cannot load from the @@ -358,8 +358,8 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { // also make sure we create the config directory within this directory // the below statement will create both the templates directory and the config and log directory - $this->configAndLogDir = - CRM_Utils_File::baseFilePath($this->templateCompileDir) . + $this->configAndLogDir + = CRM_Utils_File::baseFilePath($this->templateCompileDir) . 'ConfigAndLog' . DIRECTORY_SEPARATOR; CRM_Utils_File::createDir($this->configAndLogDir); CRM_Utils_File::restrictAccess($this->configAndLogDir); @@ -658,7 +658,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { $this->templateCompileDir, $this->uploadDir, $this->configAndLogDir, - $this->customFileUploadDir + $this->customFileUploadDir, ) as $dir) { if ($dir && is_dir($dir)) { CRM_Utils_File::restrictAccess($dir); @@ -669,10 +669,10 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { /** * Verify that the needed parameters are not null in the config * - * @param CRM_Core_Config (reference ) the system config object - * @param array (reference ) the parameters that need a value + * @param CRM_Core_Config $config (reference) the system config object + * @param array $required (reference) the parameters that need a value * - * @return boolean + * @return bool */ public static function check(&$config, &$required) { foreach ($required as $name) { diff --git a/CRM/Core/Form/Date.php b/CRM/Core/Form/Date.php index 5ddb2a6592..926666803e 100644 --- a/CRM/Core/Form/Date.php +++ b/CRM/Core/Form/Date.php @@ -86,17 +86,15 @@ class CRM_Core_Form_Date { * @param string $dateFormat * @param bool|string $displayTime * - * */ - - static function buildDateRange( + public static function buildDateRange( &$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $operators = array(), $dateFormat = 'searchDate', $displayTime = FALSE ) { - $selector = - CRM_Core_Form_Date::returnDateRangeSelector( + $selector + = CRM_Core_Form_Date::returnDateRangeSelector( $form, $fieldName, $count, $from, $to, $fromLabel, $required, $operators, @@ -128,77 +126,75 @@ class CRM_Core_Form_Date { * @return array * Values for Selector */ - static function returnDateRangeSelector( + public static function returnDateRangeSelector( &$form, $fieldName, $count = 1, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $operators = array(), $dateFormat = 'searchDate', $displayTime = FALSE ) { - $selector = - array( - '' => ts('- any -'), - 0 => ts('Choose Date Range'), - 'previous_2.year' => ts('Previous 2 Years'), - 'previous_2.quarter' => ts('Previous 2 Quarters'), - 'previous_2.month' => ts('Previous 2 Months'), - 'previous_2.week' => ts('Previous 2 Weeks'), - 'previous_2.day' => ts('Previous 2 Days'), - 'previous_before.year' => ts('Prior to Previous Year'), - 'previous_before.quarter' => ts('Prior to Previous Quarter'), - 'previous_before.month' => ts('Prior to Previous Month'), - 'previous_before.week' => ts('Prior to Previous Week'), - 'previous_before.day' => ts('Prior to Previous Day'), - 'previous.year' => ts('Previous Year'), - 'previous.fiscal_year' => ts('Previous Fiscal Year'), - 'previous.quarter' => ts('Previous Quarter'), - 'previous.month' => ts('Previous Month'), - 'previous.week' => ts('Previous Week'), - 'earlier.year' => ts('To End of Previous Year'), - 'earlier.quarter' => ts('To End of Previous Quarter'), - 'earlier.month' => ts('To End of Previous Month'), - 'earlier.week' => ts('To End of Previous Week'), - 'earlier.day' => ts('To End of Previous Day'), - 'greater_previous.year' => ts('From End of Previous Year'), - 'greater_previous.quarter' => ts('From End of Previous Quarter'), - 'greater_previous.month' => ts('From End of Previous Month'), - 'greater_previous.week' => ts('From End of Previous Week'), - 'greater.year' => ts('From Start of Current Year'), - 'greater.quarter' => ts('From Start of Current Quarter'), - 'greater.month' => ts('From Start of Current Month'), - 'greater.week' => ts('From Start of Current Week'), - 'greater.day' => ts('From Start of Current Day'), - 'current.year' => ts('Current Year to-date'), - 'current.quarter' => ts('Current Quarter to-date'), - 'current.month' => ts('Current Month to-date'), - 'current.week' => ts('Current Week to-date'), - 'ending_3.year' => ts('Last 3 Years'), - 'ending_2.year' => ts('Last 2 Years'), - 'ending.year' => ts('Last 12 Months'), - 'ending.quarter' => ts('Last 3 Months'), - 'ending.month' => ts('Last Month'), - 'ending.week' => ts('Last 7 days'), - 'previous.day' => ts('Yesterday'), - 'this.year' => ts('This Year'), - 'this.fiscal_year' => ts('This Fiscal Year'), - 'this.quarter' => ts('This Quarter'), - 'this.month' => ts('This Month'), - 'this.week' => ts('This Week'), - 'this.day' => ts('Today'), - 'starting.day' => ts('Tomorrow'), - 'starting.week' => ts('Upcoming 7 days'), - 'starting.month' => ts('Upcoming Month'), - 'starting.year' => ts('Upcoming 12 Months'), - 'less.year' => ts('To End of Current Year'), - 'less.quarter' => ts('To End of Current Quarter'), - 'less.month' => ts('To End of Current Month'), - 'less.week' => ts('To End of Current Week'), - 'next.week' => ts('Next Week'), - 'next.month' => ts('Next Month'), - 'next.quarter' => ts('Next Quarter'), - 'next.fiscal_year' => ts('Next Fiscal Year'), - 'next.year' => ts('Next Year'), - - ); + $selector = array( + '' => ts('- any -'), + 0 => ts('Choose Date Range'), + 'previous_2.year' => ts('Previous 2 Years'), + 'previous_2.quarter' => ts('Previous 2 Quarters'), + 'previous_2.month' => ts('Previous 2 Months'), + 'previous_2.week' => ts('Previous 2 Weeks'), + 'previous_2.day' => ts('Previous 2 Days'), + 'previous_before.year' => ts('Prior to Previous Year'), + 'previous_before.quarter' => ts('Prior to Previous Quarter'), + 'previous_before.month' => ts('Prior to Previous Month'), + 'previous_before.week' => ts('Prior to Previous Week'), + 'previous_before.day' => ts('Prior to Previous Day'), + 'previous.year' => ts('Previous Year'), + 'previous.fiscal_year' => ts('Previous Fiscal Year'), + 'previous.quarter' => ts('Previous Quarter'), + 'previous.month' => ts('Previous Month'), + 'previous.week' => ts('Previous Week'), + 'earlier.year' => ts('To End of Previous Year'), + 'earlier.quarter' => ts('To End of Previous Quarter'), + 'earlier.month' => ts('To End of Previous Month'), + 'earlier.week' => ts('To End of Previous Week'), + 'earlier.day' => ts('To End of Previous Day'), + 'greater_previous.year' => ts('From End of Previous Year'), + 'greater_previous.quarter' => ts('From End of Previous Quarter'), + 'greater_previous.month' => ts('From End of Previous Month'), + 'greater_previous.week' => ts('From End of Previous Week'), + 'greater.year' => ts('From Start of Current Year'), + 'greater.quarter' => ts('From Start of Current Quarter'), + 'greater.month' => ts('From Start of Current Month'), + 'greater.week' => ts('From Start of Current Week'), + 'greater.day' => ts('From Start of Current Day'), + 'current.year' => ts('Current Year to-date'), + 'current.quarter' => ts('Current Quarter to-date'), + 'current.month' => ts('Current Month to-date'), + 'current.week' => ts('Current Week to-date'), + 'ending_3.year' => ts('Last 3 Years'), + 'ending_2.year' => ts('Last 2 Years'), + 'ending.year' => ts('Last 12 Months'), + 'ending.quarter' => ts('Last 3 Months'), + 'ending.month' => ts('Last Month'), + 'ending.week' => ts('Last 7 days'), + 'previous.day' => ts('Yesterday'), + 'this.year' => ts('This Year'), + 'this.fiscal_year' => ts('This Fiscal Year'), + 'this.quarter' => ts('This Quarter'), + 'this.month' => ts('This Month'), + 'this.week' => ts('This Week'), + 'this.day' => ts('Today'), + 'starting.day' => ts('Tomorrow'), + 'starting.week' => ts('Upcoming 7 days'), + 'starting.month' => ts('Upcoming Month'), + 'starting.year' => ts('Upcoming 12 Months'), + 'less.year' => ts('To End of Current Year'), + 'less.quarter' => ts('To End of Current Quarter'), + 'less.month' => ts('To End of Current Month'), + 'less.week' => ts('To End of Current Week'), + 'next.week' => ts('Next Week'), + 'next.month' => ts('Next Month'), + 'next.quarter' => ts('Next Quarter'), + 'next.fiscal_year' => ts('Next Fiscal Year'), + 'next.year' => ts('Next Year'), + ); if (is_array($operators)) { $selector = array_merge($selector, $operators); @@ -229,8 +225,6 @@ class CRM_Core_Form_Date { * @param bool $required * @param string $dateFormat * @param bool $displayTime - * - * @return null */ public static function addDateRangeToForm(&$form, $fieldName, $selector, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $dateFormat = 'searchDate', $displayTime = FALSE) { $form->add('select', diff --git a/CRM/Core/OptionValue.php b/CRM/Core/OptionValue.php index e8627b2418..4c90973c5c 100644 --- a/CRM/Core/OptionValue.php +++ b/CRM/Core/OptionValue.php @@ -60,10 +60,10 @@ class CRM_Core_OptionValue { * * @param array $groupParams * Array containing group fields whose option-values is to retrieved. - * @param string $orderBy - * For orderBy clause. * @param array $links * Has links like edit, delete, disable ..etc. + * @param string $orderBy + * For orderBy clause. * * @return array * Array of option-values @@ -176,7 +176,7 @@ class CRM_Core_OptionValue { * @param array $groupParams * Array containing group fields whose option-values is to retrieved/saved. * @param $action - * @param int $optionValueIDHas the id of the optionValue being edited, disabled ..etc. + * @param int $optionValueID Has the id of the optionValue being edited, disabled ..etc. * Has the id of the optionValue being edited, disabled ..etc. * * @return CRM_Core_DAO_OptionValue @@ -250,7 +250,7 @@ class CRM_Core_OptionValue { * @param string $fieldName * The name of the field in the DAO. * - * @return boolean + * @return bool * true if object exists */ public static function optionExists($value, $daoName, $daoID, $optionGroupID, $fieldName = 'name') { @@ -272,7 +272,7 @@ class CRM_Core_OptionValue { * @param string $mode * @param string $contactType * - * @return boolean + * @return bool * true if object exists */ public static function getFields($mode = '', $contactType = 'Individual') { @@ -303,7 +303,7 @@ class CRM_Core_OptionValue { 'Individual', 'Household', 'Organization', - 'All' + 'All', ))) { $nameTitle = array( 'addressee' => array( @@ -381,8 +381,7 @@ class CRM_Core_OptionValue { * @param string $orderBy * For orderBy clause. * - * @param bool $isActiveDo you want only active option values?. - * Do you want only active option values?. + * @param bool $isActive Do you want only active option values? * * @return array * Array of option-values diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 521cd824d9..550db1a586 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -162,15 +162,15 @@ class CRM_Core_Page { /** * This function takes care of all the things common to all - * pages. This typically involves assigning the appropriate - * smarty variable :) + * pages. This typically involves assigning the appropriate smarty + * variable :) * - * @return string + * @return void|string * The content generated by running this page */ public function run() { if ($this->_embedded) { - return; + return NULL; } self::$_template->assign('mode', $this->_mode); @@ -186,7 +186,7 @@ class CRM_Core_Page { CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, - CRM_Core_Smarty::PRINT_JSON + CRM_Core_Smarty::PRINT_JSON, ))) { $content = self::$_template->fetch('CRM/common/snippet.tpl'); } @@ -242,7 +242,6 @@ class CRM_Core_Page { CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this); echo CRM_Utils_System::theme($content, $this->_print); - return; } /** @@ -262,8 +261,7 @@ class CRM_Core_Page { /** * Get the variable from the form scope * - * @param string name : name of the variable - * + * @param string $name name of the variable * * @return mixed */ @@ -376,7 +374,7 @@ class CRM_Core_Page { /** * Getter for embedded * - * @return boolean + * @return bool * return the embedded value */ public function getEmbedded() { @@ -397,7 +395,7 @@ class CRM_Core_Page { /** * Getter for print * - * @return boolean + * @return bool * return the print value */ public function getPrint() { diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index 635adf8629..393e462d07 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -226,7 +226,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { * @param bool $recur * @param bool $first */ - function single( + public function single( &$input, &$ids, &$objects, $recur = FALSE, $first = FALSE diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 7a5665f452..b9f0c67782 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -208,7 +208,7 @@ class CRM_Core_PseudoConstant { * - fresh boolean ignore cache entries and go back to DB * @param string $context : Context string * - * @return Array|bool + * @return array|bool * array on success, FALSE on error. * */ @@ -261,7 +261,7 @@ class CRM_Core_PseudoConstant { } // Core field: load schema - $dao = new $daoName; + $dao = new $daoName(); $fieldSpec = $dao->getFieldSpec($fieldName); $dao->free(); // If neither worked then this field doesn't exist. Return false. @@ -323,7 +323,7 @@ class CRM_Core_PseudoConstant { return FALSE; } // Get list of fields for the option table - $dao = new $daoName; + $dao = new $daoName(); $availableFields = array_keys($dao->fieldKeys()); $dao->free(); @@ -467,7 +467,7 @@ class CRM_Core_PseudoConstant { * @param string $fieldName * @param string|Int $value * - * @return bool|null|string|number + * @return bool|null|string|int * FALSE if the given field has no associated option list * NULL if the given key has no corresponding option * String|Number if key is found @@ -553,7 +553,7 @@ class CRM_Core_PseudoConstant { return $var; } - $object = new $name (); + $object = new $name(); $object->selectAdd(); $object->selectAdd("$key, $retrieve"); @@ -1735,7 +1735,7 @@ WHERE id = %1 $defaultGreetings = array(); $contactTypes = self::get('CRM_Contact_DAO_Contact', 'contact_type', array( 'keyColumn' => 'id', - 'labelColumn' => 'name' + 'labelColumn' => 'name', )); foreach ($contactTypes as $filter => $contactType) { diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index dd0f937618..872c00a728 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -1,28 +1,28 @@ 'js-strings', - 'prefetch' => FALSE, - )); + 'group' => 'js-strings', + 'prefetch' => FALSE, + )); self::$_singleton = new CRM_Core_Resources( $sys->getMapper(), $cache, @@ -189,12 +189,12 @@ class CRM_Core_Resources { */ public function addScriptUrl($url, $weight = self::DEFAULT_WEIGHT, $region = self::DEFAULT_REGION) { CRM_Core_Region::instance($region)->add(array( - 'name' => $url, - 'type' => 'scriptUrl', - 'scriptUrl' => $url, - 'weight' => $weight, - 'region' => $region, - )); + 'name' => $url, + 'type' => 'scriptUrl', + 'scriptUrl' => $url, + 'weight' => $weight, + 'region' => $region, + )); return $this; } @@ -211,12 +211,12 @@ class CRM_Core_Resources { */ public function addScript($code, $weight = self::DEFAULT_WEIGHT, $region = self::DEFAULT_REGION) { CRM_Core_Region::instance($region)->add(array( - // 'name' => automatic - 'type' => 'script', - 'script' => $code, - 'weight' => $weight, - 'region' => $region, - )); + // 'name' => automatic + 'type' => 'script', + 'script' => $code, + 'weight' => $weight, + 'region' => $region, + )); return $this; } @@ -395,12 +395,12 @@ class CRM_Core_Resources { */ public function addStyleUrl($url, $weight = self::DEFAULT_WEIGHT, $region = self::DEFAULT_REGION) { CRM_Core_Region::instance($region)->add(array( - 'name' => $url, - 'type' => 'styleUrl', - 'styleUrl' => $url, - 'weight' => $weight, - 'region' => $region, - )); + 'name' => $url, + 'type' => 'styleUrl', + 'styleUrl' => $url, + 'weight' => $weight, + 'region' => $region, + )); return $this; } @@ -417,12 +417,12 @@ class CRM_Core_Resources { */ public function addStyle($code, $weight = self::DEFAULT_WEIGHT, $region = self::DEFAULT_REGION) { CRM_Core_Region::instance($region)->add(array( - // 'name' => automatic - 'type' => 'style', - 'style' => $code, - 'weight' => $weight, - 'region' => $region, - )); + // 'name' => automatic + 'type' => 'style', + 'style' => $code, + 'weight' => $weight, + 'region' => $region, + )); return $this; } @@ -533,7 +533,7 @@ class CRM_Core_Resources { 'config' => array( 'ajaxPopupsEnabled' => $this->ajaxPopupsEnabled, 'isFrontend' => $config->userFrameworkFrontend, - ) + ), ); // Disable profile creation if user lacks permission if (!CRM_Core_Permission::check('edit all contacts') && !CRM_Core_Permission::check('add contacts')) { @@ -613,10 +613,7 @@ class CRM_Core_Resources { } /** - * Create dynamic script for localizing js widgets - * - * @return string - * javascript content + * Create dynamic script for localizing js widgets. */ public static function outputLocalizationJS() { CRM_Core_Page_AJAX::setJsHeaders(); @@ -715,7 +712,7 @@ class CRM_Core_Resources { return in_array(CRM_Utils_Array::value('snippet', $_REQUEST), array( CRM_Core_Smarty::PRINT_SNIPPET, CRM_Core_Smarty::PRINT_NOFORM, - CRM_Core_Smarty::PRINT_JSON + CRM_Core_Smarty::PRINT_JSON, )); } @@ -738,7 +735,7 @@ class CRM_Core_Resources { array('key' => '{"BETWEEN":["now - 3 month","now"]}', 'value' => ts('Past 3 Months')), array('key' => '{"BETWEEN":["now - 6 month","now"]}', 'value' => ts('Past 6 Months')), array('key' => '{"BETWEEN":["now - 1 year","now"]}', 'value' => ts('Past Year')), - ) + ), ), ); diff --git a/CRM/Custom/Page/Field.php b/CRM/Custom/Page/Field.php index e1ded4f394..30de49c4be 100644 --- a/CRM/Custom/Page/Field.php +++ b/CRM/Custom/Page/Field.php @@ -62,8 +62,6 @@ class CRM_Custom_Page_Field extends CRM_Core_Page { /** * Get the action links for this page. * - * @param null - * * @return array * array of action links that we need to display for the browse screen */ @@ -119,8 +117,6 @@ class CRM_Custom_Page_Field extends CRM_Core_Page { /** * Browse all custom group fields. * - * @param null - * * @return void */ public function browse() { @@ -226,8 +222,6 @@ class CRM_Custom_Page_Field extends CRM_Core_Page { * This method is called after the page is created. It checks for the * type of action and executes that action. * - * @param null - * * @return void */ public function run() { diff --git a/CRM/Event/Import/Parser.php b/CRM/Event/Import/Parser.php index c33ba68b8a..a95d8f1dae 100644 --- a/CRM/Event/Import/Parser.php +++ b/CRM/Event/Import/Parser.php @@ -74,7 +74,7 @@ abstract class CRM_Event_Import_Parser extends CRM_Import_Parser { * @return mixed * @throws Exception */ - function run( + public function run( $fileName, $seperator = ',', &$mapper, @@ -293,7 +293,7 @@ abstract class CRM_Event_Import_Parser extends CRM_Import_Parser { * Given a list of the importable field keys that the user has selected * set the active fields array to this list * - * @param array mapped array of values + * @param $fieldKeys array mapped array of values * * @return void */ diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index ead0bcf0ae..3ad68f4d1b 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -195,7 +195,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $this->assign('mapKey', $config->mapAPIKey); $sumLat = $sumLng = 0; $maxLat = $maxLng = -400; - $minLat = $minLng = +400; + $minLat = $minLng = 400; foreach ($locations as $location) { $sumLat += $location['lat']; $sumLng += $location['lng']; diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 17d52e685f..b82f525276 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -75,12 +75,10 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { * * @return void */ - function preProcess() { - + public function preProcess() { /** * set the button names */ - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); diff --git a/CRM/Mailing/Event/BAO/Subscribe.php b/CRM/Mailing/Event/BAO/Subscribe.php index 5cde2ff911..86cd3d2fc5 100644 --- a/CRM/Mailing/Event/BAO/Subscribe.php +++ b/CRM/Mailing/Event/BAO/Subscribe.php @@ -391,7 +391,7 @@ SELECT civicrm_email.id as email_id $group[$groupID]['status'] = $contactGroups[$groupID]['status']; $status = ts('You are already subscribed in %1, your subscription is %2.', array( 1 => $group[$groupID]['title'], - 2 => $group[$groupID]['status'] + 2 => $group[$groupID]['status'], )); CRM_Utils_System::setUFMessage($status); continue; diff --git a/CRM/SMS/Form/Schedule.php b/CRM/SMS/Form/Schedule.php index 83c285b007..b24531f153 100644 --- a/CRM/SMS/Form/Schedule.php +++ b/CRM/SMS/Form/Schedule.php @@ -121,9 +121,9 @@ class CRM_SMS_Form_Schedule extends CRM_Core_Form { * @param $files * @param $self * - * @return boolean - * True if either we deliver immediately, or the - * date is properly set. + * @return bool + * True if either we deliver immediately, or the date is properly + * set. */ public static function formRule($params, $files, $self) { if (!empty($params['_qf_Schedule_submit'])) { diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index d34ee9876f..7ec295c8fc 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -989,7 +989,7 @@ function _civicrm_api3_deprecated_add_formatted_location_blocks(&$values, &$para 'Email', 'IM', 'OpenID', - 'Phone_Ext' + 'Phone_Ext', ) as $block) { $name = strtolower($block); if (!array_key_exists($name, $values)) { diff --git a/tests/phpunit/CRM/Case/AllTests.php b/tests/phpunit/CRM/Case/AllTests.php index 261da7350b..a8ef8b0da8 100644 --- a/tests/phpunit/CRM/Case/AllTests.php +++ b/tests/phpunit/CRM/Case/AllTests.php @@ -17,7 +17,7 @@ class CRM_Case_AllTests extends CiviTestSuite { */ private static function getInstance() { if (is_null(self::$instance)) { - self::$instance = new self; + self::$instance = new self(); } return self::$instance; } diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php index 1c36c0a722..189c7b21fb 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php @@ -37,7 +37,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { 'table_name' => 'civicrm_value_test_group_' . $customGroup->id, 'column_name' => 'test_Country_' . $customField->id, 'file_id' => '', - ) + ), ); CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID); @@ -72,7 +72,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { 'table_name' => 'civicrm_value_test_group_' . $customGroup->id, 'column_name' => 'test_File_' . $customField->id, 'file_id' => 1, - ) + ), ); CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID); @@ -107,7 +107,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { 'table_name' => 'civicrm_value_test_group_' . $customGroup->id, 'column_name' => 'test_StateProvince_' . $customField->id, 'file_id' => 1, - ) + ), ); CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID); @@ -141,7 +141,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { 'table_name' => 'civicrm_value_test_group_' . $customGroup->id, 'column_name' => 'test_Date_' . $customField->id, 'file_id' => '', - ) + ), ); CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID); @@ -176,7 +176,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { 'table_name' => 'civicrm_value_test_group_' . $customGroup->id, 'column_name' => 'test_Memo_' . $customField->id, 'file_id' => '', - ) + ), ); CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID); @@ -212,7 +212,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { 'table_name' => 'civicrm_value_test_group_' . $customGroup->id, 'column_name' => 'test_Memo_' . $customField->id, 'file_id' => '', - ) + ), ); CRM_Core_BAO_CustomValueTable::store($params, 'civicrm_contact', $contactID); diff --git a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php index 3f25895f60..7afef47906 100644 --- a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php +++ b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php @@ -79,15 +79,15 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { $post_move_values[$cid_to_missing]['source'] = $this->_loadDataFromApi($cid_to_missing, $from_group_id); $post_move_values[$cid_to_missing]['destination'] = $this->_loadDataFromApi($cid_to_missing, $to_group_id); - //Make sure that only the appropriate values have changed + // Make sure that only the appropriate values have changed. foreach (array( $cid_all, $cid_from_missing, - $cid_to_missing + $cid_to_missing, ) as $cid) { foreach (array( 'source', - 'destination' + 'destination', ) as $fieldset) { foreach ($pre_move_values[$cid][$fieldset] as $id => $value) { if ($id != $field_to_move) { @@ -280,7 +280,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { 'option_07', 'option_08', 'option_09', - 'option_10' + 'option_10', ), ), 'integer' => array( @@ -403,7 +403,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { //get the custom id of the custom field that was just created $results = $this->webtest_civicrm_api("CustomField", "get", array( 'label' => $fieldLabel, - 'custom_group_id' => $group_id + 'custom_group_id' => $group_id, )); //While there _technically_ could be two fields with the same name, its highly unlikely //so assert that exactly one result is return @@ -417,7 +417,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { * @param string $prefix * @param array $values */ - function _createFieldOptions($count = 3, $prefix = "option", $values = array()) { + public function _createFieldOptions($count = 3, $prefix = "option", $values = array()) { // Only support up to 10 options on the creation form $count = $count > 10 ? 10 : $count; @@ -450,7 +450,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { $field_ids = array_keys($fields); $contact = $this->webtest_civicrm_api("Contact", "get", array( 'contact_id' => $contact_id, - 'return.custom_' . $field_ids[0] => 1 + 'return.custom_' . $field_ids[0] => 1, )); $group = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $group_id, 'return.table_name' => 1)); diff --git a/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php b/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php index 815c946134..5feeff3819 100644 --- a/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php +++ b/tests/phpunit/WebTest/Contact/CreateCmsUserFromContactTest.php @@ -37,8 +37,11 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase parent::setUp(); } - //Test that option to create a cms user is present on a contact who does not - //have a cms account already( in this case, a new contact ) + /** + * Test that option to create a cms user is present on a contact who + * does not have a cms account already (in this case, a new + * contact). + */ public function testCreateContactLinkPresent() { //login @@ -56,8 +59,10 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase $this->assertElementContainsText("css=#actions li.crm-contact-user-record", "Create User Record", "Create User Record link not in action menu of new contact"); } - //Test that the action link is missing for users who already have a contact - //record. The contact record for drupal user 1 is used + /** + * Test that the action link is missing for users who already have a + * contact record. The contact record for drupal user 1 is used. + */ public function testCreateContactLinkMissing() { //login @@ -78,7 +83,9 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase $this->assertElementNotContainsText("css=#actions li.crm-contact-user-record", "Create User Record", "Create User Record link not in action menu of new contact"); } - //Test the ajax "check username availibity" link when adding cms user + /** + * Test the ajax "check username availibity" link when adding cms user. + */ public function testCheckUsernameAvailability() { $this->webtestLogin('admin'); @@ -101,7 +108,9 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase $this->assertElementContainsText("msgbox", "This username is currently available", "Available username is indicated as being taken"); } - //Test form submission when the username is taken + /** + * Test form submission when the username is taken. + */ public function testTakenUsernameSubmission() { //login @@ -125,7 +134,9 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase $this->assertTrue($results['count'] == 0); } - //Test form sumbission when user passwords dont match + /** + * Test form sumbission when user passwords dont match. + */ public function testMismatchPasswordSubmission() { //login @@ -177,7 +188,9 @@ class WebTest_Contact_CreateCmsUserFromContactTest extends CiviSeleniumTestCase $this->assertTrue($results['count'] == 0); } - //Test a valid (username unique and passwords match) submission + /** + * Test a valid (username unique and passwords match) submission. + */ public function testValidSubmission() { //login diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index 81bc18ca2f..0880354d24 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -359,19 +359,25 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { array( 'entity' => 'ParticipantEventName', 'subEntity' => 'Fall Fundraiser Dinner', - 'triggerElement' => array('name' => "event_id", 'type' => "select2") + 'triggerElement' => array( + 'name' => "event_id", + 'type' => "select2", + ), ), array( 'entity' => 'ParticipantRole', 'subEntity' => 'Attendee', - 'triggerElement' => array('name' => 'role_id', 'type' => "select") + 'triggerElement' => array( + 'name' => 'role_id', + 'type' => "select", + ), ), ); $pageUrl = array('url' => "participant/add", 'args' => "reset=1&action=add&context=standalone"); $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, TRUE); } - /* + /** * Webtest for CRM-10983 */ public function testCheckDuplicateCustomDataLoad() { @@ -381,20 +387,41 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { array( 'entity' => 'ParticipantEventType', 'subEntity' => '- Any -', - 'triggerElement' => array('name' => "event_id", 'type' => "select") + 'triggerElement' => array( + 'name' => "event_id", + 'type' => "select", + ), ), array( 'entity' => 'ParticipantEventName', 'subEntity' => '- Any -', - 'triggerElement' => array('name' => "event_id", 'type' => "select") + 'triggerElement' => array( + 'name' => "event_id", + 'type' => "select", + ), ), array( 'entity' => 'ParticipantEventName', 'subEntity' => 'Rain-forest Cup Youth Soccer Tournament', - 'triggerElement' => array('name' => "event_id", 'type' => "select") + 'triggerElement' => array( + 'name' => "event_id", + 'type' => "select", + ), + ), + array( + 'entity' => 'ParticipantRole', + 'subEntity' => '- Any -', + 'triggerElement' => array( + 'type' => "checkbox", + ), + ), + array( + 'entity' => 'ParticipantRole', + 'subEntity' => 'Volunteer', + 'triggerElement' => array( + 'type' => "checkbox", + ), ), - array('entity' => 'ParticipantRole', 'subEntity' => '- Any -', 'triggerElement' => array('type' => "checkbox")), - array('entity' => 'ParticipantRole', 'subEntity' => 'Volunteer', 'triggerElement' => array('type' => "checkbox")), ); $return = $this->addCustomGroupField($customSets); diff --git a/tests/phpunit/WebTest/Import/DateFormatTest.php b/tests/phpunit/WebTest/Import/DateFormatTest.php index 75f6b0e3b4..73eb16c1d4 100644 --- a/tests/phpunit/WebTest/Import/DateFormatTest.php +++ b/tests/phpunit/WebTest/Import/DateFormatTest.php @@ -35,7 +35,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { parent::setUp(); } - /* + /** * Test contact import for yyyy_mm_dd date format. */ public function testDateFormat_yyyy_mm_dd() { @@ -50,7 +50,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); } - /* + /** * Test contact import for mm_dd_yy date format. */ public function testDateFormat_mm_dd_yy() { @@ -66,7 +66,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); } - /* + /** * Test contact import for mm_dd_yyyy date format. */ public function testDateFormat_mm_dd_yyyy() { @@ -87,7 +87,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); } - /* + /** * Test contact import for Month_dd_yyyy date format. */ public function testDateFormat_Month_dd_yyyy() { @@ -108,7 +108,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); } - /* + /** * Test contact import for dd_mon_yy date format. */ public function testDateFormat_dd_mon_yy() { @@ -129,7 +129,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); } - /* + /** * Test contact import for dd_mm_yyyy date format. */ public function testDateFormat_dd_mm_yyyy() { @@ -150,7 +150,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { $this->importContacts($headers, $rows, 'Individual', 'Skip', array(), $other); } - /* + /** * Helper function to provide data for contact import for Individuals and yyyy-mm-dd OR yyyymmdd dateformat. */ /** @@ -203,7 +203,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { return array($headers, $rows); } - /* + /** * Helper function to provide data for contact import for Individuals and mm/dd/yy OR mm-dd-yy dateformat. */ /** @@ -256,7 +256,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { return array($headers, $rows); } - /* + /** * Helper function to provide data for contact import for Individuals and mm/dd/yyyy OR mm-dd-yyyy dateformat. */ /** @@ -309,7 +309,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { return array($headers, $rows); } - /* + /** * Helper function to provide data for contact import for Individuals and Month dd, yyyy dateformat. */ /** @@ -362,7 +362,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { return array($headers, $rows); } - /* + /** * Helper function to provide data for contact import for Individuals and dd-mon-yy OR dd/mm/yy dateformat. */ /** @@ -415,7 +415,7 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { return array($headers, $rows); } - /* + /** * Helper function to provide data for contact import for Individuals and dd/mm/yyyy dateformat. */ /** diff --git a/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php b/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php index 8963724df0..7fb663542a 100644 --- a/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php +++ b/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php @@ -1,27 +1,27 @@ 'State', 'country' => 'Country', 'contact_relationships' => - array( - '4_a_b' => array( - 'organization_name' => 'Organization Name', - 'organization_email' => 'Organization Email', - 'organization_add' => 'Organization Street Address', - 'organization_city' => 'Organization City', - 'organization_state' => 'Organization State', - 'organization_country' => 'Organization Country', - ), - '7_a_b' => array( - 'household_name' => 'Household Name', - 'household_email' => 'Household Name', - 'household_add' => 'Household Street Address', - 'household_city' => 'Household City', - 'household_state' => 'Household State', - 'household_country' => 'Household Country', - ), - '2_a_b' => array( - 'spouse_f_name' => 'Spouse First Name', - 'spouse_l_name' => 'Spouse Last Name', - 'spouse_email' => 'Spouse Email', - 'spouse_add' => 'Spouse Street Address', - 'spouse_city' => 'Spouse City', - 'spouse_state' => 'Spouse State', - 'spouse_country' => 'Spouse Country', - ), + array( + '4_a_b' => array( + 'organization_name' => 'Organization Name', + 'organization_email' => 'Organization Email', + 'organization_add' => 'Organization Street Address', + 'organization_city' => 'Organization City', + 'organization_state' => 'Organization State', + 'organization_country' => 'Organization Country', + ), + '7_a_b' => array( + 'household_name' => 'Household Name', + 'household_email' => 'Household Name', + 'household_add' => 'Household Street Address', + 'household_city' => 'Household City', + 'household_state' => 'Household State', + 'household_country' => 'Household Country', + ), + '2_a_b' => array( + 'spouse_f_name' => 'Spouse First Name', + 'spouse_l_name' => 'Spouse Last Name', + 'spouse_email' => 'Spouse Email', + 'spouse_add' => 'Spouse Street Address', + 'spouse_city' => 'Spouse City', + 'spouse_state' => 'Spouse State', + 'spouse_country' => 'Spouse Country', ), + ), ); $rows = array( @@ -110,33 +110,33 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase 'state' => 'NY', 'country' => 'United States', 'contact_relationships' => - array( - '4_a_b' => array( - 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), - 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org', - 'organization_add' => 'Org Street Address', - 'organization_city' => 'Org City', - 'organization_state' => 'NY', - 'organization_country' => 'United States', - ), - '7_a_b' => array( - 'household_name' => 'House ' . substr(sha1(rand()), 0, 7), - 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org', - 'household_add' => 'House Street Address', - 'household_city' => 'House City', - 'household_state' => 'NY', - 'household_country' => 'United States', - ), - '2_a_b' => array( - 'spouse_f_name' => substr(sha1(rand()), 0, 7), - 'spouse_l_name' => substr(sha1(rand()), 0, 7), - 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org', - 'spouse_add' => 'Spouse Street Address', - 'spouse_city' => 'Spouse City', - 'spouse_state' => 'NY', - 'spouse_country' => 'United States', - ), + array( + '4_a_b' => array( + 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), + 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org', + 'organization_add' => 'Org Street Address', + 'organization_city' => 'Org City', + 'organization_state' => 'NY', + 'organization_country' => 'United States', ), + '7_a_b' => array( + 'household_name' => 'House ' . substr(sha1(rand()), 0, 7), + 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org', + 'household_add' => 'House Street Address', + 'household_city' => 'House City', + 'household_state' => 'NY', + 'household_country' => 'United States', + ), + '2_a_b' => array( + 'spouse_f_name' => substr(sha1(rand()), 0, 7), + 'spouse_l_name' => substr(sha1(rand()), 0, 7), + 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org', + 'spouse_add' => 'Spouse Street Address', + 'spouse_city' => 'Spouse City', + 'spouse_state' => 'NY', + 'spouse_country' => 'United States', + ), + ), ), array( 'first_name' => substr(sha1(rand()), 0, 7), @@ -150,33 +150,33 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase 'state' => 'NY', 'country' => 'United States', 'contact_relationships' => - array( - '4_a_b' => array( - 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), - 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org', - 'organization_add' => 'Org Street Address', - 'organization_city' => 'Org City', - 'organization_state' => 'NY', - 'organization_country' => 'United States', - ), - '7_a_b' => array( - 'household_name' => 'House ' . substr(sha1(rand()), 0, 7), - 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org', - 'household_add' => 'House Street Address', - 'household_city' => 'House City', - 'household_state' => 'NY', - 'household_country' => 'United States', - ), - '2_a_b' => array( - 'spouse_f_name' => substr(sha1(rand()), 0, 7), - 'spouse_l_name' => substr(sha1(rand()), 0, 7), - 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org', - 'spouse_add' => 'Spouse Street Address', - 'spouse_city' => 'Spouse City', - 'spouse_state' => 'NY', - 'spouse_country' => 'United States', - ), + array( + '4_a_b' => array( + 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), + 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org', + 'organization_add' => 'Org Street Address', + 'organization_city' => 'Org City', + 'organization_state' => 'NY', + 'organization_country' => 'United States', ), + '7_a_b' => array( + 'household_name' => 'House ' . substr(sha1(rand()), 0, 7), + 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org', + 'household_add' => 'House Street Address', + 'household_city' => 'House City', + 'household_state' => 'NY', + 'household_country' => 'United States', + ), + '2_a_b' => array( + 'spouse_f_name' => substr(sha1(rand()), 0, 7), + 'spouse_l_name' => substr(sha1(rand()), 0, 7), + 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org', + 'spouse_add' => 'Spouse Street Address', + 'spouse_city' => 'Spouse City', + 'spouse_state' => 'NY', + 'spouse_country' => 'United States', + ), + ), ), ); // for Employee of relationship diff --git a/tests/phpunit/WebTest/Profile/ProfileCountryState.php b/tests/phpunit/WebTest/Profile/ProfileCountryState.php index ab6344aa86..ee35c8e0c4 100644 --- a/tests/phpunit/WebTest/Profile/ProfileCountryState.php +++ b/tests/phpunit/WebTest/Profile/ProfileCountryState.php @@ -62,7 +62,7 @@ class WebTest_Profile_ProfileCountryState extends CiviSeleniumTestCase { $this->openCiviPage('admin/uf/group/field/add', array( 'action' => 'add', 'reset' => 1, - 'gid' => $gid + 'gid' => $gid, ), 'field_name[0]'); $this->click('field_name[0]'); $this->select('field_name[0]', 'value=Contact'); diff --git a/tests/phpunit/api/v3/EmailTest.php b/tests/phpunit/api/v3/EmailTest.php index 77608a0191..f9731e0a3b 100644 --- a/tests/phpunit/api/v3/EmailTest.php +++ b/tests/phpunit/api/v3/EmailTest.php @@ -76,13 +76,11 @@ class api_v3_EmailTest extends CiviUnitTestCase { $delresult = $this->callAPISuccess('email', 'delete', array('id' => $result['id'])); } - /* + /** * If a new email is set to is_primary the prev should no longer be * * If is_primary is not set then it should become is_primary is no others exist */ - - public function testCreateEmailPrimaryHandlingChangeToPrimary() { $params = $this->_params; unset($params['is_primary']); diff --git a/tests/phpunit/api/v3/GroupNestingTest.php b/tests/phpunit/api/v3/GroupNestingTest.php index dbc7b69efe..dbad258aa7 100644 --- a/tests/phpunit/api/v3/GroupNestingTest.php +++ b/tests/phpunit/api/v3/GroupNestingTest.php @@ -108,7 +108,7 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { 'id' => 1, 'child_group_id' => 2, 'parent_group_id' => 1, - ) + ), ); $this->assertEquals($expected, $result['values']); diff --git a/tests/phpunit/api/v3/MembershipTypeTest.php b/tests/phpunit/api/v3/MembershipTypeTest.php index 5dcf9a59fd..96c0669695 100644 --- a/tests/phpunit/api/v3/MembershipTypeTest.php +++ b/tests/phpunit/api/v3/MembershipTypeTest.php @@ -1,29 +1,29 @@ membershipTypeDelete($params); } - ///////////////// civicrm_membership_type_create methods + /** + * Civicrm_membership_type_create methods. + */ public function testCreateWithEmptyParams() { $membershiptype = $this->callAPIFailure('membership_type', 'create', array()); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id, member_of_contact_id, financial_type_id, duration_unit, duration_interval, name' - ); + ); } public function testCreateWithoutMemberOfContactId() { @@ -96,8 +98,8 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params, - 'Mandatory key(s) missing from params array: member_of_contact_id' - ); + 'Mandatory key(s) missing from params array: member_of_contact_id' + ); } public function testCreateWithoutContributionTypeId() { @@ -115,7 +117,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: financial_type_id' - ); + ); } public function testCreateWithoutDurationUnit() { @@ -133,7 +135,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: duration_unit' - ); + ); } public function testCreateWithoutDurationInterval() { @@ -150,7 +152,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: financial_type_id, duration_interval' - ); + ); } public function testCreateWithoutNameandDomainIDandDurationUnit() { @@ -167,7 +169,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id, duration_unit, name' - ); + ); } public function testCreateWithoutName() { @@ -212,7 +214,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id, member_of_contact_id, financial_type_id, duration_unit, duration_interval, name' - ); + ); } public function testUpdateWithoutId() { @@ -263,8 +265,8 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'id' => 'doesNotExist', ); $membershiptype = $this->callAPIFailure('membership_type', 'delete', $params, - 'Error while deleting membership type. id : ' . $params['id'] - ); + 'Error while deleting membership type. id : ' . $params['id'] + ); } public function testDelete() { diff --git a/tests/phpunit/api/v3/OptionGroupTest.php b/tests/phpunit/api/v3/OptionGroupTest.php index 8b6899d785..77aa3a4b99 100644 --- a/tests/phpunit/api/v3/OptionGroupTest.php +++ b/tests/phpunit/api/v3/OptionGroupTest.php @@ -45,10 +45,9 @@ class api_v3_OptionGroupTest extends CiviUnitTestCase { ); } - /* - * Good to test option group as a representative on the Camel Case - */ - + /** + * Good to test option group as a representative on the Camel Case + */ public function testGetOptionGroupGetFields() { $result = $this->callAPISuccess('option_group', 'getfields', array()); $this->assertFalse(empty($result['values']), 'In line ' . __LINE__); @@ -94,20 +93,19 @@ class api_v3_OptionGroupTest extends CiviUnitTestCase { 'value' => 35, 'is_default' => 1, 'is_active' => 1, - 'format.only_id' => 1 - ) + 'format.only_id' => 1, + ), ); $result = $this->callAPIAndDocument('OptionGroup', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals('civicrm_event.amount.560', $result['values'][0]['name'], 'In line ' . __LINE__); - $this->assertTrue(is_integer($result['values'][0]['api.OptionValue.create'])); + $this->assertTrue(is_int($result['values'][0]['api.OptionValue.create'])); $this->assertGreaterThan(0, $result['values'][0]['api.OptionValue.create']); $this->callAPISuccess('OptionGroup', 'delete', array('id' => $result['id'])); } - /* + /** * Test the error message when a failure is due to a key duplication issue */ - public function testGetOptionCreateFailOnDuplicate() { $params = array( 'sequential' => 1, @@ -120,11 +118,11 @@ class api_v3_OptionGroupTest extends CiviUnitTestCase { $this->callAPISuccess('OptionGroup', 'delete', array('id' => $result1['id'])); } - /* + /** * Test that transaction is completely rolled back on fail. - * Also check error returned + * + * Check error returned. */ - public function testGetOptionCreateFailRollback() { $countFirst = $this->callAPISuccess('OptionGroup', 'getcount', array( 'options' => array('limit' => 5000), diff --git a/tests/qunit/example/test.js b/tests/qunit/example/test.js index 9b0f8a1a1e..2b7bb51b3d 100644 --- a/tests/qunit/example/test.js +++ b/tests/qunit/example/test.js @@ -1,11 +1,11 @@ module('group a'); -test( "a basic test example", function() { +test("a basic test example", function() { var value = "hello"; - equal( value, "hello", "We expect value to be hello" ); + equal(value, "hello", "We expect value to be hello"); }); -test( "another basic test example", function() { +test("another basic test example", function() { var value = "hello"; - equal( value, "hello", "We expect value to be hello" ); + equal(value, "hello", "We expect value to be hello"); }); -- 2.25.1