diff --git a/tests/extensions/test.extension.manager.paymenttest/main.php b/tests/extensions/test.extension.manager.paymenttest/main.php index dac3dc64e3d6..e6affe4bc9e2 100644 --- a/tests/extensions/test.extension.manager.paymenttest/main.php +++ b/tests/extensions/test.extension.manager.paymenttest/main.php @@ -5,7 +5,7 @@ */ class test_extension_manager_paymenttest extends CRM_Core_Payment { - static $counts = array(); + public static $counts = array(); public function install() { self::$counts['install'] = isset(self::$counts['install']) ? self::$counts['install'] : 0; diff --git a/tests/extensions/test.extension.manager.reporttest/main.php b/tests/extensions/test.extension.manager.reporttest/main.php index 66e29af22cab..96d1b7657b81 100644 --- a/tests/extensions/test.extension.manager.reporttest/main.php +++ b/tests/extensions/test.extension.manager.reporttest/main.php @@ -4,6 +4,7 @@ * Class test_extension_manager_reporttest */ class test_extension_manager_reporttest extends CRM_Core_Report { + /** * Class constructor. */ diff --git a/tests/extensions/test.extension.manager.searchtest/main.php b/tests/extensions/test.extension.manager.searchtest/main.php index 7ae801e52baf..f1bcdcd6a15a 100644 --- a/tests/extensions/test.extension.manager.searchtest/main.php +++ b/tests/extensions/test.extension.manager.searchtest/main.php @@ -6,6 +6,7 @@ * Class test_extension_manager_searchtest */ class test_extension_manager_searchtest extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface { + /** * @param $formValues */ @@ -48,7 +49,8 @@ public function buildForm(&$form) { /** * Get a list of summary data points. * - * @return mixed; NULL or array with keys: + * @return mixed + * - NULL or array with keys: * - summary: string * - total: numeric */ diff --git a/tests/phpunit/CRM/ACL/ListTest.php b/tests/phpunit/CRM/ACL/ListTest.php index c7157d72b5c5..c9b78c76efd1 100644 --- a/tests/phpunit/CRM/ACL/ListTest.php +++ b/tests/phpunit/CRM/ACL/ListTest.php @@ -28,7 +28,8 @@ public function testViewAllPermission() { $contacts = $this->createScenarioPlain(); // test WITH all permissions - CRM_Core_Config::singleton()->userPermissionClass->permissions = NULL; // NULL means 'all permissions' in UnitTests environment + // NULL means 'all permissions' in UnitTests environment + CRM_Core_Config::singleton()->userPermissionClass->permissions = NULL; $result = CRM_Contact_BAO_Contact_Permission::allowList($contacts); sort($result); $this->assertEquals($result, $contacts, "Contacts should be viewable when 'view all contacts'"); @@ -52,7 +53,6 @@ public function testViewAllPermission() { $this->assertEmpty($result, "Contacts should NOT be viewable when 'view all contacts' is not set"); } - /** * general test for the 'view all contacts' permission */ @@ -73,7 +73,6 @@ public function testEditAllPermission() { $this->assertEmpty($result, "Contacts should NOT be viewable when 'edit all contacts' is not set"); } - /** * Test access related to the 'access deleted contact' permission */ @@ -95,7 +94,6 @@ public function testViewEditDeleted() { $this->assertEquals(count($result), count($contacts) - 1, "Only deleted contacts should be excluded"); } - /** * Test access based on relations * @@ -177,7 +175,6 @@ public function testPermissionByRelation() { } } - /** * Test access based on ACL */ @@ -202,7 +199,6 @@ public function testPermissionByACL() { $this->assertContains($contacts[4], $result, "User[0] should NOT have an ACL permission on contact[4]."); } - /** * Test access with a mix of ACL and relationship */ @@ -285,10 +281,9 @@ public function testPermissionCompare() { } } - - /**************************************************** - * Scenario Builders * - ***************************************************/ + /* + * Scenario Builders + */ /** * create plain test scenario, no relationships/ACLs @@ -322,66 +317,79 @@ protected function createScenarioRelations() { // create some relationships $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 1, // CHILD OF + // CHILD OF + 'relationship_type_id' => 1, 'contact_id_a' => $contacts[1], 'contact_id_b' => $contacts[0], 'is_permission_b_a' => 1, 'is_active' => 1, - )); + )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 1, // CHILD OF + // CHILD OF + 'relationship_type_id' => 1, 'contact_id_a' => $contacts[2], 'contact_id_b' => $contacts[1], 'is_permission_b_a' => 1, 'is_active' => 1, - )); + )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 1, // CHILD OF + // CHILD OF + 'relationship_type_id' => 1, 'contact_id_a' => $contacts[4], 'contact_id_b' => $contacts[2], 'is_permission_b_a' => 1, 'is_active' => 1, - )); + )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 4, // SIBLING OF + // SIBLING OF + 'relationship_type_id' => 4, 'contact_id_a' => $contacts[5], 'contact_id_b' => $contacts[0], - 'is_permission_b_a' => 2, // View + // View + 'is_permission_b_a' => 2, 'is_active' => 1, )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 1, // CHILD OF + // CHILD OF + 'relationship_type_id' => 1, 'contact_id_a' => $contacts[6], 'contact_id_b' => $contacts[5], - 'is_permission_b_a' => 1, // Edit + // Edit + 'is_permission_b_a' => 1, 'is_active' => 1, )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 1, // CHILD OF + // CHILD OF + 'relationship_type_id' => 1, 'contact_id_a' => $contacts[7], 'contact_id_b' => $contacts[5], - 'is_permission_b_a' => 2, // View + // View + 'is_permission_b_a' => 2, 'is_active' => 1, )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 4, // SIBLING OF + // SIBLING OF + 'relationship_type_id' => 4, 'contact_id_a' => $contacts[0], 'contact_id_b' => $contacts[8], - 'is_permission_a_b' => 1, // edit (as a_b) + // edit (as a_b) + 'is_permission_a_b' => 1, 'is_active' => 1, )); $this->callAPISuccess('Relationship', 'create', array( - 'relationship_type_id' => 1, // CHILD OF + // CHILD OF + 'relationship_type_id' => 1, 'contact_id_a' => $contacts[9], 'contact_id_b' => $contacts[8], - 'is_permission_b_a' => 2, // view + // view + 'is_permission_b_a' => 2, 'is_active' => 1, )); diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php index 39e9df34f740..09330c5fbdb8 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php @@ -55,7 +55,6 @@ public function testRetrieveTargetIdsByActivityIdZeroID() { $this->assertSame($target, array(), 'No targets returned'); } - public function testRetrieveTargetIdsByActivityIdOneID() { $activity = $this->activityCreate(); diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php index 51b3dcd4def0..1f49256bb887 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); $this->prepareForACLs(); @@ -343,7 +344,8 @@ public function testGetActivitiesCountforNonAdminDashboard() { 'caseId' => NULL, 'context' => 'home', 'activity_type_id' => NULL, - 'activity_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'), // for dashlet the Scheduled status is set by default + // for dashlet the Scheduled status is set by default + 'activity_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'), 'offset' => 0, 'rowCount' => 0, 'sort' => NULL, @@ -513,7 +515,8 @@ public function testGetActivitiesforNonAdminDashboard() { 'caseId' => NULL, 'context' => 'home', 'activity_type_id' => NULL, - 'activity_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'), // for dashlet the Scheduled status is set by default + // for dashlet the Scheduled status is set by default + 'activity_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'), 'offset' => 0, 'rowCount' => 0, 'sort' => NULL, @@ -958,7 +961,7 @@ public function getActivityDateData() { 'count' => 2, 'earliest' => strtotime('first day of january last year'), 'latest' => strtotime('first day of january this year'), - ] + ], ], ]; } @@ -1040,7 +1043,8 @@ protected function setUpForActivityDashboardTests() { 'caseId' => NULL, 'context' => 'home', 'activity_type_id' => NULL, - 'activity_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'), // for dashlet the Scheduled status is set by default + // for dashlet the Scheduled status is set by default + 'activity_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'), 'offset' => 0, 'rowCount' => 0, 'sort' => NULL, @@ -1239,7 +1243,6 @@ public function testSendSMSMobileInToProviderParamWithDoNotSMS() { $this->assertEquals(0, $success, "Expected success to be 0"); } - /** * @param int $phoneType (0=no phone, phone_type option group (1=fixed, 2=mobile) * @param bool $passPhoneTypeInContactDetails diff --git a/tests/phpunit/CRM/Activity/Form/SearchTest.php b/tests/phpunit/CRM/Activity/Form/SearchTest.php index 9061313f1f5a..e5ec443e98e4 100644 --- a/tests/phpunit/CRM/Activity/Form/SearchTest.php +++ b/tests/phpunit/CRM/Activity/Form/SearchTest.php @@ -116,7 +116,7 @@ public function getSearchCriteria() { ], [ 'search_criteria' => [ - ['activity_status_id', '=', ['IN' => ['1', '2']], 0, 0] + ['activity_status_id', '=', ['IN' => ['1', '2']], 0, 0], ], 'expected_qill' => [['Activity Status In Scheduled, Completed']], ], diff --git a/tests/phpunit/CRM/Batch/BAO/BatchTest.php b/tests/phpunit/CRM/Batch/BAO/BatchTest.php index 7a9631ac9348..1e7b4664e917 100644 --- a/tests/phpunit/CRM/Batch/BAO/BatchTest.php +++ b/tests/phpunit/CRM/Batch/BAO/BatchTest.php @@ -66,7 +66,7 @@ public function testGetBatchFinancialItems() { ]); $this->contributionCreate([ 'contact_id' => $contactId, - 'total_amount' => 1, + 'total_amount' => 1, 'payment_instrument_id' => 'Credit Card', 'financial_type_id' => 'Member Dues', 'contribution_status_id' => 'Completed', diff --git a/tests/phpunit/CRM/Bridge/OG/DrupalTest.php b/tests/phpunit/CRM/Bridge/OG/DrupalTest.php index 566f8820dbd1..fdbda500498a 100644 --- a/tests/phpunit/CRM/Bridge/OG/DrupalTest.php +++ b/tests/phpunit/CRM/Bridge/OG/DrupalTest.php @@ -41,6 +41,7 @@ * @group headless */ class CRM_Bridge_OG_DrupalTest extends CiviUnitTestCase { + /** * Test that one (ane only one) role (option value) is deleted by the updateCiviACLRole function */ diff --git a/tests/phpunit/CRM/Case/BAO/CaseTypeForkTest.php b/tests/phpunit/CRM/Case/BAO/CaseTypeForkTest.php index 21f0c46eb639..caa23c93d3b4 100644 --- a/tests/phpunit/CRM/Case/BAO/CaseTypeForkTest.php +++ b/tests/phpunit/CRM/Case/BAO/CaseTypeForkTest.php @@ -6,6 +6,7 @@ * @group headless */ class CRM_Case_BAO_CaseTypeForkTest extends CiviCaseTestCase { + public function setUp() { parent::setUp(); CRM_Core_ManagedEntities::singleton(TRUE)->reconcile(); @@ -41,7 +42,6 @@ public function testManagerContact() { $this->assertEquals($relTypeID, $xmlProcessor->getCaseManagerRoleId('ForkableCaseType')); } - /** * Edit the definition of ForkableCaseType. */ diff --git a/tests/phpunit/CRM/Case/BAO/CaseTypeTest.php b/tests/phpunit/CRM/Case/BAO/CaseTypeTest.php index d0f8bed73dc6..b83fac0cca96 100644 --- a/tests/phpunit/CRM/Case/BAO/CaseTypeTest.php +++ b/tests/phpunit/CRM/Case/BAO/CaseTypeTest.php @@ -117,13 +117,13 @@ public function definitionProvider() { $cases = array(); foreach (array( - 'empty-defn', - 'empty-lists', - 'one-item-in-each', - 'two-items-in-each', - 'forkable-0', - 'forkable-1', - ) as $key) { + 'empty-defn', + 'empty-lists', + 'one-item-in-each', + 'two-items-in-each', + 'forkable-0', + 'forkable-1', + ) as $key) { $cases[] = array($key, $fixtures[$key]['json'], $fixtures[$key]['xml']); } return $cases; @@ -187,8 +187,10 @@ public function testRoundtrip_JsonToXmlToJson($fixtureName, $inputJson, $ignore) */ public function normalizeXml($xml) { return trim( - preg_replace(":\n*<:", "\n<", // tags on new lines - preg_replace("/\n[\n ]+/", "\n", // no leading whitespace + // tags on new lines + preg_replace(":\n*<:", "\n<", + // no leading whitespace + preg_replace("/\n[\n ]+/", "\n", $xml ) ) diff --git a/tests/phpunit/CRM/Case/BAO/QueryTest.php b/tests/phpunit/CRM/Case/BAO/QueryTest.php index 9bef8b6b0252..3543366524ff 100644 --- a/tests/phpunit/CRM/Case/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Case/BAO/QueryTest.php @@ -59,9 +59,9 @@ public function testWhereClauseSingle() { $queryObj = new CRM_Contact_BAO_Query($params, NULL, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CASE); $this->assertEquals(array( - 0 => 'Activity Type = Contribution', - 1 => 'Activity Type = Scheduled', - 2 => 'Activity Medium = In Person', + 0 => 'Activity Type = Contribution', + 1 => 'Activity Type = Scheduled', + 2 => 'Activity Medium = In Person', ), $queryObj->_qill[1] ); diff --git a/tests/phpunit/CRM/Case/XMLProcessor/ProcessTest.php b/tests/phpunit/CRM/Case/XMLProcessor/ProcessTest.php index 2d30c0bc82f2..53dcd83690ac 100644 --- a/tests/phpunit/CRM/Case/XMLProcessor/ProcessTest.php +++ b/tests/phpunit/CRM/Case/XMLProcessor/ProcessTest.php @@ -37,18 +37,18 @@ protected function setUpContacts() { */ protected function setupDefaultAssigneeOptions() { $options = [ - 'NONE', 'BY_RELATIONSHIP', 'SPECIFIC_CONTACT', 'USER_CREATING_THE_CASE' + 'NONE', 'BY_RELATIONSHIP', 'SPECIFIC_CONTACT', 'USER_CREATING_THE_CASE', ]; CRM_Core_BAO_OptionGroup::ensureOptionGroupExists([ - 'name' => 'activity_default_assignee' + 'name' => 'activity_default_assignee', ]); foreach ($options as $option) { $optionValue = CRM_Core_BAO_OptionValue::ensureOptionValueExists([ 'option_group_id' => 'activity_default_assignee', 'name' => $option, - 'label' => $option + 'label' => $option, ]); $this->defaultAssigneeOptionsValues[$option] = $optionValue['value']; @@ -65,19 +65,19 @@ protected function setupRelationships() { 'name_a_b' => 'Pupil of', 'name_b_a' => 'Instructor', 'contact_id_a' => $this->contacts['ana'], - 'contact_id_b' => $this->contacts['beto'] + 'contact_id_b' => $this->contacts['beto'], ], 'ana_is_spouse_of_carlos' => [ 'type_id' => NULL, 'name_a_b' => 'Spouse of', 'name_b_a' => 'Spouse of', 'contact_id_a' => $this->contacts['ana'], - 'contact_id_b' => $this->contacts['carlos'] + 'contact_id_b' => $this->contacts['carlos'], ], 'unassigned_employee' => [ 'type_id' => NULL, 'name_a_b' => 'Employee of', - 'name_b_a' => 'Employer' + 'name_b_a' => 'Employer', ], ]; @@ -88,7 +88,7 @@ protected function setupRelationships() { 'name_a_b' => $relationship['name_a_b'], 'label_a_b' => $relationship['name_a_b'], 'name_b_a' => $relationship['name_b_a'], - 'label_b_a' => $relationship['name_b_a'] + 'label_b_a' => $relationship['name_b_a'], ]); if (isset($relationship['contact_id_a'])) { @@ -231,7 +231,7 @@ protected function assertActivityAssignedToContactExists($assigneeContactId) { $expectedContact = $assigneeContactId === NULL ? [] : [$assigneeContactId]; $result = $this->callAPISuccess('Activity', 'get', [ 'target_contact_id' => $this->activityParams['clientID'], - 'return' => ['assignee_contact_id'] + 'return' => ['assignee_contact_id'], ]); $activity = CRM_Utils_Array::first($result['values']); diff --git a/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php b/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php index cfad097932c8..69a094ac6d58 100644 --- a/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php @@ -43,7 +43,6 @@ class CRM_Contact_BAO_ActivitySearchTest extends CiviUnitTestCase { protected $_params; protected $test_activity_type_value; - /** * Test setup for every test. * diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index 81998d865d31..cc168dfeac4b 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -1550,7 +1550,8 @@ public function _testTimestamps($callbacks) { $prevTimestamps = $origTimestamps; foreach ($callbacks as $callbackName => $callback) { - sleep(1); // advance clock by 1 second to ensure timestamps change + // advance clock by 1 second to ensure timestamps change + sleep(1); $callback($contactId); $newTimestamps = CRM_Contact_BAO_Contact::getTimestamps($contactId); diff --git a/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php b/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php index faf560bd736c..b8af15bcba9c 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php @@ -486,7 +486,6 @@ public function testSmartGroupSearchBuilder() { $this->callAPISuccess('group', 'delete', ['id' => $group2->id]); } - public function testMultipleGroupWhereClause() { $returnProperties = array( 'contact_type' => 1, diff --git a/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php b/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php index 0a1957923729..718a6232497d 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php @@ -192,7 +192,6 @@ public function testContactSearchByParentGroup() { $this->callAPISuccess('Contact', 'delete', array('id' => $childSmartGroupContact)); } - /** * CRM-19698: Test case for combine contact search in regular and smart group */ diff --git a/tests/phpunit/CRM/Contact/BAO/GroupTest.php b/tests/phpunit/CRM/Contact/BAO/GroupTest.php index 481e9bca1a4f..b37d5ddb366c 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupTest.php @@ -94,7 +94,8 @@ public function testGroupHirearchy() { 'name' => uniqid(), 'title' => 'Parent Group B', 'description' => 'Parent Group Two', - 'is_active' => 0, // disable + // disable + 'is_active' => 0, )); $group2 = CRM_Contact_BAO_Group::create($params); diff --git a/tests/phpunit/CRM/Contact/BAO/IndividualTest.php b/tests/phpunit/CRM/Contact/BAO/IndividualTest.php index 71938a96fc73..9d70a7e2ae99 100644 --- a/tests/phpunit/CRM/Contact/BAO/IndividualTest.php +++ b/tests/phpunit/CRM/Contact/BAO/IndividualTest.php @@ -58,8 +58,10 @@ public function testFormatDisplayNamePrefixesById() { 'contact_type' => 'Individual', 'first_name' => 'Ben', 'last_name' => 'Lee', - 'prefix_id' => 4, // this is the doctor - 'suffix_id' => 2, // and the doctor is a senior + // this is the doctor + 'prefix_id' => 4, + // and the doctor is a senior + 'suffix_id' => 2, ); $contact = new CRM_Contact_DAO_Contact(); diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index abbe151527e6..95ea92894a18 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -78,10 +78,10 @@ public function testSearchProfileHomeCityCRM14263() { $contactID = $this->individualCreate(); CRM_Core_Config::singleton()->defaultSearchProfileID = 1; $this->callAPISuccess('address', 'create', array( - 'contact_id' => $contactID, - 'city' => 'Cool City', - 'location_type_id' => 1, - )); + 'contact_id' => $contactID, + 'city' => 'Cool City', + 'location_type_id' => 1, + )); $params = array( 0 => array( 0 => 'city-1', @@ -117,10 +117,10 @@ public function testSearchProfileHomeCityNoResultsCRM14263() { $contactID = $this->individualCreate(); CRM_Core_Config::singleton()->defaultSearchProfileID = 1; $this->callAPISuccess('address', 'create', array( - 'contact_id' => $contactID, - 'city' => 'Cool City', - 'location_type_id' => 1, - )); + 'contact_id' => $contactID, + 'city' => 'Cool City', + 'location_type_id' => 1, + )); $params = array( 0 => array( 0 => 'city-1', @@ -242,7 +242,6 @@ public function testSearchOtherLocationUpperLower() { $resultDAO->fetch(); } - /** * CRM-14263 search builder failure with search profile & address in criteria. * @@ -252,16 +251,18 @@ public function testSearchOtherLocationUpperLower() { * @dataProvider getSearchProfileData * * @param array $params + * @param string $selectClause + * @param string $whereClause */ public function testSearchProfilePrimaryCityCRM14263($params, $selectClause, $whereClause) { $contactID = $this->individualCreate(); CRM_Core_Config::singleton()->defaultSearchProfileID = 1; $this->callAPISuccess('address', 'create', array( - 'contact_id' => $contactID, - 'city' => 'Cool CITY', - 'street_address' => 'Long STREET', - 'location_type_id' => 1, - )); + 'contact_id' => $contactID, + 'city' => 'Cool CITY', + 'street_address' => 'Long STREET', + 'location_type_id' => 1, + )); $returnProperties = array( 'contact_type' => 1, 'contact_sub_type' => 1, @@ -770,7 +771,7 @@ public function testGetSummaryQueryWithFinancialACLDisabled() { 'avg' => '$ 233.33', 'amount' => '$ 1,400.00', 'count' => 6, - ], + ], 'cancel' => [ 'count' => 2, 'amount' => '$ 100.00', @@ -822,13 +823,15 @@ public function testGetSummaryQueryWithFinancialACLEnabled() { */ public function testConvertFormValuesCRM21816() { $fv = array( - "member_end_date_relative" => "starting_2.month", // next 60 days + // next 60 days + "member_end_date_relative" => "starting_2.month", "member_end_date_low" => "20180101000000", "member_end_date_high" => "20180331235959", "membership_is_current_member" => "1", "member_is_primary" => "1", ); - $fv_orig = $fv; // $fv is modified by convertFormValues() + // $fv is modified by convertFormValues() + $fv_orig = $fv; $params = CRM_Contact_BAO_Query::convertFormValues($fv); // restructure for easier testing diff --git a/tests/phpunit/CRM/Contact/BAO/RelationshipTest.php b/tests/phpunit/CRM/Contact/BAO/RelationshipTest.php index 7a58b6d9a63a..4ad1e3412364 100644 --- a/tests/phpunit/CRM/Contact/BAO/RelationshipTest.php +++ b/tests/phpunit/CRM/Contact/BAO/RelationshipTest.php @@ -51,7 +51,7 @@ protected function tearDown() { $this->quickCleanup([ 'civicrm_relationship_type', 'civicrm_relationship', - 'civicrm_contact' + 'civicrm_contact', ]); parent::tearDown(); @@ -120,7 +120,7 @@ public function testContactIdAndRelationshipIdWillBeUsedInFilter() { $options = CRM_Contact_BAO_Relationship::buildRelationshipTypeOptions([ 'relationship_id' => (string) $relationship['id'], - 'contact_id' => $individual['id'] + 'contact_id' => $individual['id'], ]); // for this relationship only individual=>organization is possible @@ -132,7 +132,7 @@ public function testContactIdAndRelationshipIdWillBeUsedInFilter() { $this->assertNotContains($personToPersonReverseType, $options); $options = CRM_Contact_BAO_Relationship::buildRelationshipTypeOptions([ - 'contact_id' => $individual['id'] + 'contact_id' => $individual['id'], ]); // for this result we only know that "A" must be an individual diff --git a/tests/phpunit/CRM/Contact/Form/Search/Custom/FullTextTest.php b/tests/phpunit/CRM/Contact/Form/Search/Custom/FullTextTest.php index 7d84df4864c5..4bff5fb7f96a 100644 --- a/tests/phpunit/CRM/Contact/Form/Search/Custom/FullTextTest.php +++ b/tests/phpunit/CRM/Contact/Form/Search/Custom/FullTextTest.php @@ -1,30 +1,29 @@ groupCreate([ 'group_type' => [ $groupTypes['Access Control'] => 1, - ] + ], ]); // Add random 5 contacts to a group. $this->groupContactCreate($groupId, 5); diff --git a/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php b/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php index e1312ea1d8e0..f6a4598d3205 100644 --- a/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php +++ b/tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php @@ -89,9 +89,9 @@ public function testImportParserWtihEmployeeOfRelationship() { $this->assertEquals(CRM_Import_Parser::VALID, $parser->import(CRM_Import_Parser::DUPLICATE_UPDATE, $values), 'Return code from parser import was not as expected'); $this->callAPISuccess("Contact", "get", array( - "first_name" => "Alok", - "last_name" => "Patel", - "organization_name" => "Agileware", + "first_name" => "Alok", + "last_name" => "Patel", + "organization_name" => "Agileware", )); } @@ -272,7 +272,6 @@ public function testImportDeceased() { $this->callAPISuccess('Contact', 'delete', array('id' => $contact['id'])); } - /** * Test that the import parser adds the address to the primary location. * diff --git a/tests/phpunit/CRM/Contact/SelectorTest.php b/tests/phpunit/CRM/Contact/SelectorTest.php index 1eb5337323e3..917396028bda 100644 --- a/tests/phpunit/CRM/Contact/SelectorTest.php +++ b/tests/phpunit/CRM/Contact/SelectorTest.php @@ -40,6 +40,7 @@ class CRM_Contact_SelectorTest extends CiviUnitTestCase { public function tearDown() { } + /** * Test the query from the selector class is consistent with the dataset expectation. * @@ -147,11 +148,11 @@ public function testPrevNextCache() { // build cache key and use to it to fetch prev-next cache record $cacheKey = 'civicrm search ' . $key; $contacts = CRM_Utils_SQL_Select::from('civicrm_prevnext_cache') - ->select(['entity_id1', 'cacheKey']) - ->where("cacheKey = @key") - ->param('key', $cacheKey) - ->execute() - ->fetchAll(); + ->select(['entity_id1', 'cacheKey']) + ->where("cacheKey = @key") + ->param('key', $cacheKey) + ->execute() + ->fetchAll(); $this->assertEquals(1, count($contacts)); // check the prevNext record matches $expectedEntry = [ @@ -293,13 +294,15 @@ public function querySets() { * Test the contact ID query does not fail on country search. */ public function testContactIDQuery() { - $params = [[ - 0 => 'country-1', - 1 => '=', - 2 => '1228', - 3 => 1, - 4 => 0, - ]]; + $params = [ + [ + 0 => 'country-1', + 1 => '=', + 2 => '1228', + 3 => 1, + 4 => 0, + ], + ]; $searchOBJ = new CRM_Contact_Selector(NULL); $searchOBJ->contactIDQuery($params, '1_u'); @@ -325,13 +328,15 @@ public function testSelectorQueryOnNonASCIIlocationType() { $selector = new CRM_Contact_Selector( 'CRM_Contact_Selector', ['email' => ['IS NOT NULL' => 1]], - [[ - 0 => 'email-' . $locationType->id, - 1 => 'IS NOT NULL', - 2 => NULL, - 3 => 1, - 4 => 0, - ]], + [ + [ + 0 => 'email-' . $locationType->id, + 1 => 'IS NOT NULL', + 2 => NULL, + 3 => 1, + 4 => 0, + ], + ], [ 'contact_type' => 1, 'contact_sub_type' => 1, @@ -380,23 +385,30 @@ public function testWhereClauseByOperator() { 'IN' => ['IN' => ['Adam']], ]; $filtersByWhereClause = [ - 'IS NOT NULL' => '( contact_a.first_name IS NOT NULL )', // doesn't matter - '=' => "( contact_a.first_name = 'Adam' )", // case sensitive check - 'LIKE' => "( contact_a.first_name LIKE '%Ad%' )", // case insensitive check - 'RLIKE' => "( contact_a.first_name RLIKE BINARY '^A[a-z]{3}$' )", // case sensitive check - 'IN' => '( contact_a.first_name IN ("Adam") )', // case sensitive check + // doesn't matter + 'IS NOT NULL' => '( contact_a.first_name IS NOT NULL )', + // case sensitive check + '=' => "( contact_a.first_name = 'Adam' )", + // case insensitive check + 'LIKE' => "( contact_a.first_name LIKE '%Ad%' )", + // case sensitive check + 'RLIKE' => "( contact_a.first_name RLIKE BINARY '^A[a-z]{3}$' )", + // case sensitive check + 'IN' => '( contact_a.first_name IN ("Adam") )', ]; foreach ($filters as $op => $filter) { $selector = new CRM_Contact_Selector( 'CRM_Contact_Selector', ['first_name' => [$op => $filter]], - [[ - 0 => 'first_name', - 1 => $op, - 2 => $filter, - 3 => 1, - 4 => 0, - ]], + [ + [ + 0 => 'first_name', + 1 => $op, + 2 => $filter, + 3 => 1, + 4 => 0, + ], + ], [], CRM_Core_Action::NONE, NULL, @@ -419,13 +431,15 @@ public function testWhereClauseByOperator() { */ public function testSelectorQueryOrderByCustomField() { //Search for any params. - $params = [[ - 0 => 'country-1', - 1 => '=', - 2 => '1228', - 3 => 1, - 4 => 0, - ]]; + $params = [ + [ + 0 => 'country-1', + 1 => '=', + 2 => '1228', + 3 => 1, + 4 => 0, + ], + ]; //Create a test custom group and field. $customGroup = $this->callAPISuccess('CustomGroup', 'create', array( @@ -505,7 +519,8 @@ public function testCustomDateField() { 2 => 1, 3 => 1, 4 => 0, - ]], + ], + ], [], CRM_Core_Action::NONE, NULL, diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 16a9d0eb4781..44505f9f462c 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -331,7 +331,8 @@ public function testAnnualQueryWithFinancialACLsEnabled() { public function testAnnualWithMultipleLineItems() { $contactID = $this->createLoggedInUserWithFinancialACL(); $this->createContributionWithTwoLineItemsAgainstPriceSet([ - 'contact_id' => $contactID] + 'contact_id' => $contactID, + ] ); $this->enableFinancialACLs(); $sql = CRM_Contribute_BAO_Contribution::getAnnualQuery([$contactID]); @@ -1382,14 +1383,12 @@ public function createContributionWithTax($params = array()) { $form = new CRM_Contribute_Form_Contribution(); $form->testSubmit(array( - 'total_amount' => $params['total_amount'], - 'financial_type_id' => $financialType['id'], - 'contact_id' => $contactId, - 'contribution_status_id' => 1, - 'price_set_id' => 0, - ), - CRM_Core_Action::ADD - ); + 'total_amount' => $params['total_amount'], + 'financial_type_id' => $financialType['id'], + 'contact_id' => $contactId, + 'contribution_status_id' => 1, + 'price_set_id' => 0, + ), CRM_Core_Action::ADD); $contribution = $this->callAPISuccessGetSingle('Contribution', array( 'contact_id' => $contactId, diff --git a/tests/phpunit/CRM/Contribute/BAO/QueryTest.php b/tests/phpunit/CRM/Contribute/BAO/QueryTest.php index b3e27b9bca63..8942d740cfca 100644 --- a/tests/phpunit/CRM/Contribute/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/QueryTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Contribute_BAO_QueryTest extends CiviUnitTestCase { + public function tearDown() { $this->quickCleanUpFinancialEntities(); } diff --git a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php index 8904cf1ccfe5..81e35403654a 100644 --- a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php @@ -34,9 +34,6 @@ */ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase { - /** - * Assume empty database with just civicrm_data. - */ protected $_individualId; protected $_contribution; protected $_financialTypeId = 1; @@ -158,8 +155,7 @@ public function testSubmit($thousandSeparator) { 'contact_id' => $this->_individualId, 'payment_instrument_id' => array_search('Check', $this->paymentInstruments), 'contribution_status_id' => 1, - ), - CRM_Core_Action::ADD); + ), CRM_Core_Action::ADD); $contribution = $this->callAPISuccessGetSingle('Contribution', array('contact_id' => $this->_individualId)); $this->assertEmpty($contribution['amount_level']); $this->assertEquals(1234, $contribution['total_amount']); @@ -181,8 +177,7 @@ public function testSubmitCreditCard() { $this->callAPISuccessGetCount('Contribution', array( 'contact_id' => $this->_individualId, 'contribution_status_id' => 'Completed', - ), - 1); + ), 1); } /** @@ -240,7 +235,7 @@ public function testSubmitCreditCardPayPal() { 'payment_instrument_id' => $this->callAPISuccessGetValue('PaymentProcessor', array( 'return' => 'payment_instrument_id', 'id' => $paymentProcessorID, - )), + )), )); $this->assertEquals(1, $contribution["count"], "Contribution count should be one."); @@ -314,7 +309,6 @@ public function testSubmitCreditCardWithEmailReceipt() { $mut->stop(); } - /** * Test the submit function on the contribution page. */ @@ -369,7 +363,7 @@ public function testSubmitCreditCardNoReceipt() { 'payment_instrument_id' => $this->callAPISuccessGetValue('PaymentProcessor', array( 'return' => 'payment_instrument_id', 'id' => $this->paymentProcessorID, - )), + )), ), 1); $contact = $this->callAPISuccessGetSingle('Contact', array('id' => $this->_individualId)); $this->assertTrue(empty($contact['source'])); @@ -501,9 +495,7 @@ public function testSubmitCreditCardInvalid() { 'payment_processor_id' => $this->paymentProcessorID, 'credit_card_exp_date' => array('M' => 5, 'Y' => 2012), 'credit_card_number' => '411111111111111', - ), CRM_Core_Action::ADD, - 'live' - ); + ), CRM_Core_Action::ADD, 'live'); } catch (\Civi\Payment\Exception\PaymentProcessorException $e) { $this->callAPISuccessGetCount('Contribution', array( @@ -540,9 +532,7 @@ public function testSubmitCreditCardWithBillingAddress() { 'credit_card_exp_date' => array('M' => 5, 'Y' => 2025), 'credit_card_number' => '411111111111111', 'billing_city-5' => 'Vancouver', - ), CRM_Core_Action::ADD, - 'live' - ); + ), CRM_Core_Action::ADD, 'live'); $contribution = $this->callAPISuccessGetSingle('Contribution', array('return' => 'address_id')); $this->assertNotEmpty($contribution['address_id']); // CRM-18490 : There is a unwanted test leakage due to below getsingle Api as it only fails in Jenkin @@ -573,9 +563,7 @@ public function testSubmitCreditCardWithRecur() { 'credit_card_exp_date' => array('M' => 5, 'Y' => 2025), 'credit_card_number' => '411111111111111', 'billing_city-5' => 'Vancouver', - ), CRM_Core_Action::ADD, - 'live' - ); + ), CRM_Core_Action::ADD, 'live'); $contribution = $this->callAPISuccessGetSingle('Contribution', array('return' => 'receive_date')); $this->assertEquals($contribution['receive_date'], $receiveDate); } @@ -593,9 +581,7 @@ public function testSubmitCreditCardWithNoBillingAddress() { 'payment_processor_id' => $this->paymentProcessorID, 'credit_card_exp_date' => array('M' => 5, 'Y' => 2025), 'credit_card_number' => '411111111111111', - ), CRM_Core_Action::ADD, - 'live' - ); + ), CRM_Core_Action::ADD, 'live'); $contribution = $this->callAPISuccessGetSingle('Contribution', array('return' => 'address_id')); $this->assertEmpty($contribution['address_id']); $this->callAPISuccessGetCount('Address', array( @@ -620,8 +606,8 @@ public function testSubmitEmailReceipt() { ), CRM_Core_Action::ADD); $this->callAPISuccessGetCount('Contribution', array('contact_id' => $this->_individualId), 1); $mut->checkMailLog(array( - '
Please print this receipt for your records.
', - ) + 'Please print this receipt for your records.
', + ) ); $mut->stop(); } @@ -646,10 +632,9 @@ public function testSubmitEmailReceiptUserEmailFromAddress() { ), CRM_Core_Action::ADD); $this->callAPISuccessGetCount('Contribution', array('contact_id' => $this->_individualId), 1); $mut->checkMailLog(array( - 'Please print this receipt for your records.
', - 'Please print this receipt for your records.
', + 'Test event type - 1
', - $this->formatMoneyInput(1550.55), - ] - ); + 'Test event type - 1
', + $this->formatMoneyInput(1550.55), + ]); } /** diff --git a/tests/phpunit/CRM/Event/Form/Registration/RegistrationTest.php b/tests/phpunit/CRM/Event/Form/Registration/RegistrationTest.php index 757119cbefca..260d2d422e2a 100644 --- a/tests/phpunit/CRM/Event/Form/Registration/RegistrationTest.php +++ b/tests/phpunit/CRM/Event/Form/Registration/RegistrationTest.php @@ -35,7 +35,6 @@ public function setUp() { parent::setUp(); } - /** * CRM-19626 - Test minimum value configured for priceset. */ diff --git a/tests/phpunit/CRM/Export/BAO/ExportTest.php b/tests/phpunit/CRM/Export/BAO/ExportTest.php index 00626abc0f83..156cc1d29518 100644 --- a/tests/phpunit/CRM/Export/BAO/ExportTest.php +++ b/tests/phpunit/CRM/Export/BAO/ExportTest.php @@ -654,7 +654,7 @@ public function testExportIMData() { $relationships = [ $this->contactIDs[1] => ['label' => 'Spouse of'], $this->contactIDs[2] => ['label' => 'Household Member of'], - $this->contactIDs[3] => ['label' => 'Employee of'] + $this->contactIDs[3] => ['label' => 'Employee of'], ]; foreach ($relationships as $contactID => $relationshipType) { @@ -662,7 +662,7 @@ public function testExportIMData() { $result = $this->callAPISuccess('Relationship', 'create', [ 'contact_id_a' => $this->contactIDs[0], 'relationship_type_id' => $relationshipTypeID, - 'contact_id_b' => $contactID + 'contact_id_b' => $contactID, ]); $relationships[$contactID]['id'] = $result['id']; $relationships[$contactID]['relationship_type_id'] = $relationshipTypeID; @@ -817,7 +817,6 @@ public function testExportIMData() { } - /** * Test phone data export. * @@ -845,7 +844,7 @@ public function testExportPhoneData() { } $relationships = [ - $this->contactIDs[1] => ['label' => 'Spouse of'] + $this->contactIDs[1] => ['label' => 'Spouse of'], ]; foreach ($relationships as $contactID => $relationshipType) { @@ -853,7 +852,7 @@ public function testExportPhoneData() { $result = $this->callAPISuccess('Relationship', 'create', [ 'contact_id_a' => $this->contactIDs[0], 'relationship_type_id' => $relationshipTypeID, - 'contact_id_b' => $contactID + 'contact_id_b' => $contactID, ]); $relationships[$contactID]['id'] = $result['id']; $relationships[$contactID]['relationship_type_id'] = $relationshipTypeID; @@ -943,7 +942,7 @@ public function testExportAddressData() { $relationships = [ $this->contactIDs[1] => ['label' => 'Spouse of'], $this->contactIDs[2] => ['label' => 'Household Member of'], - $this->contactIDs[3] => ['label' => 'Employee of'] + $this->contactIDs[3] => ['label' => 'Employee of'], ]; foreach ($relationships as $contactID => $relationshipType) { @@ -951,7 +950,7 @@ public function testExportAddressData() { $result = $this->callAPISuccess('Relationship', 'create', [ 'contact_id_a' => $this->contactIDs[0], 'relationship_type_id' => $relationshipTypeID, - 'contact_id_b' => $contactID + 'contact_id_b' => $contactID, ]); $relationships[$contactID]['id'] = $result['id']; $relationships[$contactID]['relationship_type_id'] = $relationshipTypeID; @@ -1148,6 +1147,7 @@ public function getReasonsNotToMail() { [[], ['street_address' => '']], ]; } + /** * @return array */ @@ -1158,8 +1158,8 @@ protected function setUpHousehold() { 'api.Address.create' => [ 'city' => 'Portland', 'state_province_id' => 'Maine', - 'location_type_id' => 'Home' - ] + 'location_type_id' => 'Home', + ], ]); $relationshipTypes = $this->callAPISuccess('RelationshipType', 'get', [])['values']; @@ -1738,6 +1738,7 @@ public function textExportParticipantSpecifyFieldsNoPayment() { list($tableName, $sqlColumns) = $this->doExport($selectedFields, $this->contactIDs[1], CRM_Export_Form_Select::EVENT_EXPORT); $this->assertEquals($expected, $sqlColumns); } + /** * Get all return fields (@todo - still being built up. * @@ -2035,90 +2036,90 @@ public function getSqlColumnsOutput() { */ protected function getBasicHeaderDefinition($isContactExport) { $headers = [ - 0 => 'Contact ID', - 1 => 'Contact Type', - 2 => 'Contact Subtype', - 3 => 'Do Not Email', - 4 => 'Do Not Phone', - 5 => 'Do Not Mail', - 6 => 'Do Not Sms', - 7 => 'Do Not Trade', - 8 => 'No Bulk Emails (User Opt Out)', - 9 => 'Legal Identifier', - 10 => 'External Identifier', - 11 => 'Sort Name', - 12 => 'Display Name', - 13 => 'Nickname', - 14 => 'Legal Name', - 15 => 'Image Url', - 16 => 'Preferred Communication Method', - 17 => 'Preferred Language', - 18 => 'Preferred Mail Format', - 19 => 'Contact Hash', - 20 => 'Contact Source', - 21 => 'First Name', - 22 => 'Middle Name', - 23 => 'Last Name', - 24 => 'Individual Prefix', - 25 => 'Individual Suffix', - 26 => 'Formal Title', - 27 => 'Communication Style', - 28 => 'Email Greeting ID', - 29 => 'Postal Greeting ID', - 30 => 'Addressee ID', - 31 => 'Job Title', - 32 => 'Gender', - 33 => 'Birth Date', - 34 => 'Deceased', - 35 => 'Deceased Date', - 36 => 'Household Name', - 37 => 'Organization Name', - 38 => 'Sic Code', - 39 => 'Unique ID (OpenID)', - 40 => 'Current Employer ID', - 41 => 'Contact is in Trash', - 42 => 'Created Date', - 43 => 'Modified Date', - 44 => 'Addressee', - 45 => 'Email Greeting', - 46 => 'Postal Greeting', - 47 => 'Current Employer', - 48 => 'Location Type', - 49 => 'Street Address', - 50 => 'Street Number', - 51 => 'Street Number Suffix', - 52 => 'Street Name', - 53 => 'Street Unit', - 54 => 'Supplemental Address 1', - 55 => 'Supplemental Address 2', - 56 => 'Supplemental Address 3', - 57 => 'City', - 58 => 'Postal Code Suffix', - 59 => 'Postal Code', - 60 => 'Latitude', - 61 => 'Longitude', - 62 => 'Address Name', - 63 => 'Master Address Belongs To', - 64 => 'County', - 65 => 'State', - 66 => 'Country', - 67 => 'Phone', - 68 => 'Phone Extension', - 69 => 'Phone Type', - 70 => 'Email', - 71 => 'On Hold', - 72 => 'Use for Bulk Mail', - 73 => 'Signature Text', - 74 => 'Signature Html', - 75 => 'IM Provider', - 76 => 'IM Screen Name', - 77 => 'OpenID', - 78 => 'World Region', - 79 => 'Website', - 80 => 'Group(s)', - 81 => 'Tag(s)', - 82 => 'Note(s)', - ]; + 0 => 'Contact ID', + 1 => 'Contact Type', + 2 => 'Contact Subtype', + 3 => 'Do Not Email', + 4 => 'Do Not Phone', + 5 => 'Do Not Mail', + 6 => 'Do Not Sms', + 7 => 'Do Not Trade', + 8 => 'No Bulk Emails (User Opt Out)', + 9 => 'Legal Identifier', + 10 => 'External Identifier', + 11 => 'Sort Name', + 12 => 'Display Name', + 13 => 'Nickname', + 14 => 'Legal Name', + 15 => 'Image Url', + 16 => 'Preferred Communication Method', + 17 => 'Preferred Language', + 18 => 'Preferred Mail Format', + 19 => 'Contact Hash', + 20 => 'Contact Source', + 21 => 'First Name', + 22 => 'Middle Name', + 23 => 'Last Name', + 24 => 'Individual Prefix', + 25 => 'Individual Suffix', + 26 => 'Formal Title', + 27 => 'Communication Style', + 28 => 'Email Greeting ID', + 29 => 'Postal Greeting ID', + 30 => 'Addressee ID', + 31 => 'Job Title', + 32 => 'Gender', + 33 => 'Birth Date', + 34 => 'Deceased', + 35 => 'Deceased Date', + 36 => 'Household Name', + 37 => 'Organization Name', + 38 => 'Sic Code', + 39 => 'Unique ID (OpenID)', + 40 => 'Current Employer ID', + 41 => 'Contact is in Trash', + 42 => 'Created Date', + 43 => 'Modified Date', + 44 => 'Addressee', + 45 => 'Email Greeting', + 46 => 'Postal Greeting', + 47 => 'Current Employer', + 48 => 'Location Type', + 49 => 'Street Address', + 50 => 'Street Number', + 51 => 'Street Number Suffix', + 52 => 'Street Name', + 53 => 'Street Unit', + 54 => 'Supplemental Address 1', + 55 => 'Supplemental Address 2', + 56 => 'Supplemental Address 3', + 57 => 'City', + 58 => 'Postal Code Suffix', + 59 => 'Postal Code', + 60 => 'Latitude', + 61 => 'Longitude', + 62 => 'Address Name', + 63 => 'Master Address Belongs To', + 64 => 'County', + 65 => 'State', + 66 => 'Country', + 67 => 'Phone', + 68 => 'Phone Extension', + 69 => 'Phone Type', + 70 => 'Email', + 71 => 'On Hold', + 72 => 'Use for Bulk Mail', + 73 => 'Signature Text', + 74 => 'Signature Html', + 75 => 'IM Provider', + 76 => 'IM Screen Name', + 77 => 'OpenID', + 78 => 'World Region', + 79 => 'Website', + 80 => 'Group(s)', + 81 => 'Tag(s)', + 82 => 'Note(s)', + ]; if (!$isContactExport) { unset($headers[80]); unset($headers[81]); diff --git a/tests/phpunit/CRM/Extension/BrowserTest.php b/tests/phpunit/CRM/Extension/BrowserTest.php index 065b94ce13a6..722bfdf803fa 100644 --- a/tests/phpunit/CRM/Extension/BrowserTest.php +++ b/tests/phpunit/CRM/Extension/BrowserTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Extension_BrowserTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); } diff --git a/tests/phpunit/CRM/Extension/Container/BasicTest.php b/tests/phpunit/CRM/Extension/Container/BasicTest.php index b3aea51c473a..7bd9ba822c66 100644 --- a/tests/phpunit/CRM/Extension/Container/BasicTest.php +++ b/tests/phpunit/CRM/Extension/Container/BasicTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Extension_Container_BasicTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); } diff --git a/tests/phpunit/CRM/Extension/Container/CollectionTest.php b/tests/phpunit/CRM/Extension/Container/CollectionTest.php index a258453a5ed8..d79a0a097484 100644 --- a/tests/phpunit/CRM/Extension/Container/CollectionTest.php +++ b/tests/phpunit/CRM/Extension/Container/CollectionTest.php @@ -47,12 +47,12 @@ public function testGetKeysEmpty() { public function testGetKeys() { $c = $this->_createContainer(); $this->assertEquals(array( - 'test.conflict', - 'test.whiz', - 'test.whizbang', - 'test.foo', - 'test.foo.bar', - ), $c->getKeys()); + 'test.conflict', + 'test.whiz', + 'test.whizbang', + 'test.foo', + 'test.foo.bar', + ), $c->getKeys()); } public function testGetPath() { @@ -97,8 +97,10 @@ public function testCaching() { $this->assertTrue(is_array($cache->get('ext-collection'))); $cacheData = $cache->get('ext-collection'); - $this->assertEquals('a', $cacheData['test.foo']); // 'test.foo' was defined in the 'a' container - $this->assertEquals('b', $cacheData['test.whiz']); // 'test.whiz' was defined in the 'b' container + // 'test.foo' was defined in the 'a' container + $this->assertEquals('a', $cacheData['test.foo']); + // 'test.whiz' was defined in the 'b' container + $this->assertEquals('b', $cacheData['test.whiz']); } /** diff --git a/tests/phpunit/CRM/Extension/Container/StaticTest.php b/tests/phpunit/CRM/Extension/Container/StaticTest.php index 46edf4d1f9f4..c5e460d93ad6 100644 --- a/tests/phpunit/CRM/Extension/Container/StaticTest.php +++ b/tests/phpunit/CRM/Extension/Container/StaticTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Extension_Container_StaticTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); } diff --git a/tests/phpunit/CRM/Extension/InfoTest.php b/tests/phpunit/CRM/Extension/InfoTest.php index 879cb76288c7..492a34b88c9b 100644 --- a/tests/phpunit/CRM/Extension/InfoTest.php +++ b/tests/phpunit/CRM/Extension/InfoTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Extension_InfoTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); $this->file = NULL; diff --git a/tests/phpunit/CRM/Extension/Manager/ModuleTest.php b/tests/phpunit/CRM/Extension/Manager/ModuleTest.php index 282e912a5d7f..a193171490c7 100644 --- a/tests/phpunit/CRM/Extension/Manager/ModuleTest.php +++ b/tests/phpunit/CRM/Extension/Manager/ModuleTest.php @@ -140,7 +140,8 @@ public function testInstall_DirtyRemove_Disable_Uninstall() { $this->assertHookCounts('test_extension_manager_module_auto1', array( 'install' => 1, 'enable' => 1, - 'disable' => 0, // normally called -- but not for missing modules! + // normally called -- but not for missing modules! + 'disable' => 0, 'uninstall' => 0, )); $this->assertModuleActiveByName(FALSE, 'test_extension_manager_module_auto1'); @@ -150,8 +151,10 @@ public function testInstall_DirtyRemove_Disable_Uninstall() { $this->assertHookCounts('test_extension_manager_module_auto1', array( 'install' => 1, 'enable' => 1, - 'disable' => 0, // normally called -- but not for missing modules! - 'uninstall' => 0, // normally called -- but not for missing modules! + // normally called -- but not for missing modules! + 'disable' => 0, + // normally called -- but not for missing modules! + 'uninstall' => 0, )); $this->assertEquals('unknown', $manager->getStatus('test.extension.manager.module.auto1')); $this->assertModuleActiveByName(FALSE, 'test_extension_manager_module_auto1'); @@ -193,7 +196,8 @@ public function testInstall_DirtyRemove_Disable_Restore() { $this->assertHookCounts('test_extension_manager_module_auto2', array( 'install' => 1, 'enable' => 1, - 'disable' => 0, // normally called -- but not for missing modules! + // normally called -- but not for missing modules! + 'disable' => 0, 'uninstall' => 0, )); $this->assertModuleActiveByName(FALSE, 'test_extension_manager_module_auto2'); @@ -233,7 +237,8 @@ public function assertHookCounts($module, $counts) { * @param $prefix */ public function assertModuleActiveByName($expectedIsActive, $prefix) { - $activeModules = CRM_Core_PseudoConstant::getModuleExtensions(TRUE); // FIXME + // FIXME + $activeModules = CRM_Core_PseudoConstant::getModuleExtensions(TRUE); foreach ($activeModules as $activeModule) { if ($activeModule['prefix'] == $prefix) { $this->assertEquals($expectedIsActive, TRUE); diff --git a/tests/phpunit/CRM/Extension/Manager/ReportTest.php b/tests/phpunit/CRM/Extension/Manager/ReportTest.php index 99aea38dc2e5..3d44db92bfc6 100644 --- a/tests/phpunit/CRM/Extension/Manager/ReportTest.php +++ b/tests/phpunit/CRM/Extension/Manager/ReportTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Extension_Manager_ReportTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); //if (class_exists('test_extension_manager_reporttest')) { diff --git a/tests/phpunit/CRM/Extension/Manager/SearchTest.php b/tests/phpunit/CRM/Extension/Manager/SearchTest.php index 4771997cf0d8..d6b28e52eb01 100644 --- a/tests/phpunit/CRM/Extension/Manager/SearchTest.php +++ b/tests/phpunit/CRM/Extension/Manager/SearchTest.php @@ -5,6 +5,7 @@ * @group headless */ class CRM_Extension_Manager_SearchTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); //if (class_exists('test_extension_manager_searchtest')) { diff --git a/tests/phpunit/CRM/Extension/ManagerTest.php b/tests/phpunit/CRM/Extension/ManagerTest.php index 53afb936c2d9..3cf5b894c155 100644 --- a/tests/phpunit/CRM/Extension/ManagerTest.php +++ b/tests/phpunit/CRM/Extension/ManagerTest.php @@ -93,7 +93,8 @@ public function testInstall_Disable_Uninstall() { ->method('onPostDisable'); $manager->disable(array('test.foo.bar')); $this->assertEquals('disabled', $manager->getStatus('test.foo.bar')); - $this->assertEquals('installed', $manager->getStatus('test.whiz.bang')); // no side-effect + // no side-effect + $this->assertEquals('installed', $manager->getStatus('test.whiz.bang')); $testingTypeManager ->expects($this->once()) @@ -103,7 +104,8 @@ public function testInstall_Disable_Uninstall() { ->method('onPostUninstall'); $manager->uninstall(array('test.foo.bar')); $this->assertEquals('uninstalled', $manager->getStatus('test.foo.bar')); - $this->assertEquals('installed', $manager->getStatus('test.whiz.bang')); // no side-effect + // no side-effect + $this->assertEquals('installed', $manager->getStatus('test.whiz.bang')); } /** @@ -222,7 +224,6 @@ public function test_InstallAuto_DisableUpstream() { $this->assertEquals('uninstalled', $manager->getStatus('test.whiz.bang')); } - /** * Install an extension and then harshly remove the underlying source. * Subseuently disable and uninstall. @@ -341,7 +342,8 @@ public function testInstall_Disable_Install() { $testingTypeManager ->expects($this->once()) ->method('onPostEnable'); - $manager->install(array('test.foo.bar')); // install() instead of enable() + // install() instead of enable() + $manager->install(array('test.foo.bar')); $this->assertEquals('installed', $manager->getStatus('test.foo.bar')); } @@ -368,7 +370,8 @@ public function testEnableBare() { $testingTypeManager ->expects($this->never()) ->method('onPostEnable'); - $manager->enable(array('test.foo.bar')); // enable not install + // enable not install + $manager->enable(array('test.foo.bar')); $this->assertEquals('installed', $manager->getStatus('test.foo.bar')); } @@ -400,10 +403,12 @@ public function testReplace_Unknown() { $this->download = $this->_createDownload('test.newextension', 'newextension'); $testingTypeManager - ->expects($this->never())// no data to replace + // no data to replace + ->expects($this->never()) ->method('onPreReplace'); $testingTypeManager - ->expects($this->never())// no data to replace + // no data to replace + ->expects($this->never()) ->method('onPostReplace'); $manager->replace($this->download); $this->assertEquals('uninstalled', $manager->getStatus('test.newextension')); @@ -428,10 +433,12 @@ public function testReplace_Uninstalled() { $this->download = $this->_createDownload('test.whiz.bang', 'newextension'); $testingTypeManager - ->expects($this->never())// no data to replace + // no data to replace + ->expects($this->never()) ->method('onPreReplace'); $testingTypeManager - ->expects($this->never())// no data to replace + // no data to replace + ->expects($this->never()) ->method('onPostReplace'); $manager->replace($this->download); $this->assertEquals('uninstalled', $manager->getStatus('test.whiz.bang')); diff --git a/tests/phpunit/CRM/Extension/MapperTest.php b/tests/phpunit/CRM/Extension/MapperTest.php index 748d6ab16e90..828852ee7547 100644 --- a/tests/phpunit/CRM/Extension/MapperTest.php +++ b/tests/phpunit/CRM/Extension/MapperTest.php @@ -9,17 +9,32 @@ class CRM_Extension_MapperTest extends CiviUnitTestCase { /** * @var string */ - protected $basedir, $basedir2; + protected $basedir; + + /** + * @var string + */ + protected $basedir2; + + /** + * @var CRM_Extension_Container_Interface + */ + protected $container; /** * @var CRM_Extension_Container_Interface */ - protected $container, $containerWithSlash; + protected $containerWithSlash; + + /** + * @var CRM_Extension_Mapper + */ + protected $mapper; /** * @var CRM_Extension_Mapper */ - protected $mapper, $mapperWithSlash; + protected $mapperWithSlash; public function setUp() { parent::setUp(); diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php index 2fb343e29038..6217d95b1636 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php @@ -318,14 +318,12 @@ public function testGetPreviousFinancialItemHavingTax($thousandSeparator) { $this->relationForFinancialTypeWithFinancialAccount(1); $form = new CRM_Contribute_Form_Contribution(); $form->testSubmit(array( - 'total_amount' => 100, - 'financial_type_id' => 1, - 'contact_id' => $contactId, - 'contribution_status_id' => 1, - 'price_set_id' => 0, - ), - CRM_Core_Action::ADD - ); + 'total_amount' => 100, + 'financial_type_id' => 1, + 'contact_id' => $contactId, + 'contribution_status_id' => 1, + 'price_set_id' => 0, + ), CRM_Core_Action::ADD); $contribution = $this->callAPISuccessGetSingle('Contribution', array( 'contact_id' => $contactId, diff --git a/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTest.php b/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTest.php index 1a12e8a8d030..729bd1cd63ad 100644 --- a/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTest.php +++ b/tests/phpunit/CRM/Financial/BAO/PaymentProcessorTest.php @@ -30,6 +30,7 @@ * @group headless */ class CRM_Financial_BAO_PaymentProcessorTest extends CiviUnitTestCase { + public function setUp() { parent::setUp(); } diff --git a/tests/phpunit/CRM/Financial/Page/AjaxBatchSummaryTest.php b/tests/phpunit/CRM/Financial/Page/AjaxBatchSummaryTest.php index c4ed28412f9d..9ae40bcb891d 100644 --- a/tests/phpunit/CRM/Financial/Page/AjaxBatchSummaryTest.php +++ b/tests/phpunit/CRM/Financial/Page/AjaxBatchSummaryTest.php @@ -30,6 +30,7 @@ * @group headless */ class CRM_Financial_Page_AjaxBatchSummaryTest extends CiviUnitTestCase { + /** * Test the makeBatchSummary function. * diff --git a/tests/phpunit/CRM/Group/Page/AjaxTest.php b/tests/phpunit/CRM/Group/Page/AjaxTest.php index b6eb77718be8..fd69fd866e51 100644 --- a/tests/phpunit/CRM/Group/Page/AjaxTest.php +++ b/tests/phpunit/CRM/Group/Page/AjaxTest.php @@ -38,15 +38,15 @@ public function setUp() { $this->hookClass = CRM_Utils_Hook::singleton(); $this->createLoggedInUser(); $this->_permissionedDisabledGroup = $this->groupCreate(array( - 'title' => 'pick-me-disabled', - 'is_active' => 0, - 'name' => 'pick-me-disabled', - )); + 'title' => 'pick-me-disabled', + 'is_active' => 0, + 'name' => 'pick-me-disabled', + )); $this->_permissionedGroup = $this->groupCreate(array( - 'title' => 'pick-me-active', - 'is_active' => 1, - 'name' => 'pick-me-active', - )); + 'title' => 'pick-me-active', + 'is_active' => 1, + 'name' => 'pick-me-active', + )); $this->groupCreate(array('title' => 'not-me-disabled', 'is_active' => 0, 'name' => 'not-me-disabled')); $this->groupCreate(array('title' => 'not-me-active', 'is_active' => 1, 'name' => 'not-me-active')); } @@ -242,7 +242,6 @@ public function testGroupListViewAllContactsAll() { $this->assertEquals('pick-me-disabled', $groups['data'][3]['title']); } - /** * Retrieve groups as 'view all contacts' */ @@ -443,7 +442,6 @@ public function testGroupListAclGroupHookDisabledNotFound() { $this->assertEquals(0, $groups['recordsTotal'], 'Total needs to be set correctly'); } - /** * ACL Group hook. */ diff --git a/tests/phpunit/CRM/Logging/LoggingTest.php b/tests/phpunit/CRM/Logging/LoggingTest.php index f10464447430..880cddb22ff5 100644 --- a/tests/phpunit/CRM/Logging/LoggingTest.php +++ b/tests/phpunit/CRM/Logging/LoggingTest.php @@ -30,7 +30,6 @@ public function testMultilingualLogging() { $logging->disableLogging(); } - /** * Test creating logging schema when database is in multilingual mode. * Also test altering a multilingual table. diff --git a/tests/phpunit/CRM/Mailing/BAO/MailingTest.php b/tests/phpunit/CRM/Mailing/BAO/MailingTest.php index cff6d4fc3aef..326f43408556 100644 --- a/tests/phpunit/CRM/Mailing/BAO/MailingTest.php +++ b/tests/phpunit/CRM/Mailing/BAO/MailingTest.php @@ -265,7 +265,6 @@ public function hook_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups } } - /** * @todo Missing tests: * - Ensure opt out emails are not mailed @@ -610,9 +609,9 @@ public function alterMailingRecipients(&$mailingObject, &$criteria, $context) { // modify the filter to include only deceased recipient(s) that is Tagged $criteria['is_deceased'] = CRM_Utils_SQL_Select::fragment()->where("civicrm_contact.is_deceased = 1"); $criteria['tagged_contact'] = CRM_Utils_SQL_Select::fragment() - ->join('civicrm_entity_tag', "INNER JOIN civicrm_entity_tag et ON et.entity_id = civicrm_contact.id AND et.entity_table = 'civicrm_contact'") - ->join('civicrm_tag', "INNER JOIN civicrm_tag t ON t.id = et.tag_id") - ->where("t.name = 'Tagged'"); + ->join('civicrm_entity_tag', "INNER JOIN civicrm_entity_tag et ON et.entity_id = civicrm_contact.id AND et.entity_table = 'civicrm_contact'") + ->join('civicrm_tag', "INNER JOIN civicrm_tag t ON t.id = et.tag_id") + ->where("t.name = 'Tagged'"); } else { $mailingRecipients = $this->callAPISuccess('MailingRecipients', 'get', array( diff --git a/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php b/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php index 3c658fc4e3e4..5b1238a72e38 100644 --- a/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php +++ b/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php @@ -76,7 +76,8 @@ public function setUp() { public function tearDown() { $this->_mut->stop(); CRM_Utils_Hook::singleton()->reset(); - CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; // DGW + // DGW + CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; parent::tearDown(); } @@ -125,9 +126,11 @@ public function testText() { $this->assertEquals('plain', $message->body->subType); $this->assertRegExp( ";" . - "Sample Header for TEXT formatted content.\n" . // Default header + // Default header + "Sample Header for TEXT formatted content.\n" . "BEWARE children need regular infusions of toys. Santa knows your .*\\. There is no http.*civicrm/mailing/optout.*\\.\n" . - "to unsubscribe: http.*civicrm/mailing/optout" . // Default footer + // Default footer + "to unsubscribe: http.*civicrm/mailing/optout" . ";", $message->body->text ); @@ -156,10 +159,13 @@ public function testHtmlWithOpenTracking() { $this->assertEquals('html', $htmlPart->subType); $this->assertRegExp( ";" . - "Sample Header for HTML formatted content.\n" . // Default header + // Default header + "Sample Header for HTML formatted content.\n" . // FIXME: CiviMail puts double " after hyperlink! - "You can go to Google or opt out.
\n" . // body_html - "Sample Footer for HTML formatted content" . // Default footer + // body_html + "You can go to Google or opt out.
\n" . + // Default footer + "Sample Footer for HTML formatted content" . ".*\n" . "{{ts("Hello world")}}
', array('Hello world'), ); - $cases[] = array(// two strings, addition + // two strings, addition + $cases[] = array( '{{ts("How do you do?")}}
', array('Hello world', 'How do you do?'), ); - $cases[] = array(// single quoted + // single quoted + $cases[] = array( '',
diff --git a/tests/phpunit/CRM/Utils/ICalendarTest.php b/tests/phpunit/CRM/Utils/ICalendarTest.php
index fad955750da6..1ed549e67b6e 100644
--- a/tests/phpunit/CRM/Utils/ICalendarTest.php
+++ b/tests/phpunit/CRM/Utils/ICalendarTest.php
@@ -37,10 +37,12 @@ class CRM_Utils_ICalendarTest extends CiviUnitTestCase {
public function escapeExamples() {
$cases = array();
$cases[] = array("Hello
- this is, a test!");
+ this is, a test!",
+ );
$cases[] = array("Hello!!
- this is, a \"test\"!");
+ this is, a \"test\"!",
+ );
return $cases;
}
diff --git a/tests/phpunit/CRM/Utils/JSTest.php b/tests/phpunit/CRM/Utils/JSTest.php
index 8a35e9419f19..612f8be0945d 100644
--- a/tests/phpunit/CRM/Utils/JSTest.php
+++ b/tests/phpunit/CRM/Utils/JSTest.php
@@ -30,6 +30,7 @@
* @group headless
*/
class CRM_Utils_JSTest extends CiviUnitTestCase {
+
/**
* @return array
*/
@@ -39,27 +40,33 @@ public function translateExamples() {
'',
array(),
);
- $cases[] = array(// missing ts
+ // missing ts
+ $cases[] = array(
'alert("Hello world")',
array(),
);
- $cases[] = array(// basic function call
+ // basic function call
+ $cases[] = array(
'alert(ts("Hello world"));',
array('Hello world'),
);
- $cases[] = array(// with arg
+ // with arg
+ $cases[] = array(
'alert(ts("Hello world", {1: "whiz"}));',
array('Hello world'),
);
- $cases[] = array(// not really ts()
+ // not really ts()
+ $cases[] = array(
'alert(clients("Hello world"));',
array(),
);
- $cases[] = array(// not really ts()
+ // not really ts()
+ $cases[] = array(
'alert(clients("Hello world", {1: "whiz"}));',
array(),
);
- $cases[] = array(// with arg
+ // with arg
+ $cases[] = array(
"\n" .
"public function whits() {\n" .
" for (a in b) {\n" .
@@ -70,15 +77,18 @@ public function translateExamples() {
"}\n",
array('Hello'),
);
- $cases[] = array(// duplicate
+ // duplicate
+ $cases[] = array(
'alert(ts("Hello world") + "-" + ts("Hello world"));',
array('Hello world'),
);
- $cases[] = array(// two strings, addition
+ // two strings, addition
+ $cases[] = array(
'alert(ts("Hello world") + "-" + ts("How do you do?"));',
array('Hello world', 'How do you do?'),
);
- $cases[] = array(// two strings, separate calls
+ // two strings, separate calls
+ $cases[] = array(
'alert(ts("Hello world");\nalert(ts("How do you do?"));',
array('Hello world', 'How do you do?'),
);
@@ -86,11 +96,13 @@ public function translateExamples() {
'alert(ts(\'Single quoted\'));',
array('Single quoted'),
);
- $cases[] = array(// unclear string
+ // unclear string
+ $cases[] = array(
'alert(ts(message));',
array(),
);
- $cases[] = array(// ts() within a string
+ // ts() within a string
+ $cases[] = array(
'alert(ts("Does the ts(\'example\') notation work?"));',
array('Does the ts(\'example\') notation work?'),
);
diff --git a/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php b/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php
index 9b1d189fffa7..8abebc844a12 100644
--- a/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php
+++ b/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php
@@ -4,7 +4,6 @@
* Class CRM_Utils_Mail_EmailProcessorTest
* @group headless
*/
-
class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase {
/**
@@ -61,7 +60,7 @@ public function testBounceProcessingInvalidCharacter() {
$this->setUpMailing();
$mail = 'test_invalid_character.eml';
- copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail);
+ copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail);
$this->callAPISuccess('job', 'fetch_bounces', array());
$this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail));
$this->checkMailingBounces(1);
@@ -74,7 +73,7 @@ public function testBounceProcessingUTF8mb4() {
$this->setUpMailing();
$mail = 'test_utf8mb4_character.txt';
- copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail);
+ copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail);
$this->callAPISuccess('job', 'fetch_bounces', array());
$this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail));
$this->checkMailingBounces(1);
@@ -89,7 +88,7 @@ public function testProcessingMultipartRelatedEmail() {
$this->setUpMailing();
$mail = 'test_sample_message.eml';
- copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail);
+ copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail);
$this->callAPISuccess('job', 'fetch_bounces', array());
$this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail));
$this->checkMailingBounces(1);
diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php
index 04ff5dc283f9..68072e3cabd0 100644
--- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php
+++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php
@@ -109,11 +109,11 @@ public function dataProvider() {
// If user supplies wildcards, then ignore mode.
foreach (array(
- 'simple',
- 'wildphrase',
- 'wildwords',
- 'wildwords-suffix',
- ) as $mode) {
+ 'simple',
+ 'wildphrase',
+ 'wildwords',
+ 'wildwords-suffix',
+ ) as $mode) {
$cases[] = array('first% second', 'like', $mode, 'first% second', array(3, 7));
$cases[] = array('first% second', 'fts', $mode, 'first* second', array(3, 7));
$cases[] = array('first% second', 'ftsbool', $mode, '+first* +second', array(3, 7));
@@ -134,6 +134,7 @@ public function dataProvider() {
* @param string $language
* @param string $mode
* @param string $expectedText
+ * @param array|NULL $expectedRowIds
*
* @dataProvider dataProvider
*/
diff --git a/tests/phpunit/CRM/Utils/RuleTest.php b/tests/phpunit/CRM/Utils/RuleTest.php
index edf81083b202..188089faaa1e 100644
--- a/tests/phpunit/CRM/Utils/RuleTest.php
+++ b/tests/phpunit/CRM/Utils/RuleTest.php
@@ -146,7 +146,7 @@ public function alphanumericData() {
'-',
'_foo',
'one-two',
- 'f00'
+ 'f00',
];
$expectFalse = [
' ',
@@ -157,7 +157,7 @@ public function alphanumericData() {
"",
'(foo)',
'foo;',
- '[foo]'
+ '[foo]',
];
$data = [];
foreach ($expectTrue as $value) {
diff --git a/tests/phpunit/CRM/Utils/SQL/InsertTest.php b/tests/phpunit/CRM/Utils/SQL/InsertTest.php
index 5a502243f63f..ba997cca805c 100644
--- a/tests/phpunit/CRM/Utils/SQL/InsertTest.php
+++ b/tests/phpunit/CRM/Utils/SQL/InsertTest.php
@@ -5,6 +5,7 @@
* @group headless
*/
class CRM_Utils_SQL_InsertTest extends CiviUnitTestCase {
+
public function testRow_twice() {
$insert = CRM_Utils_SQL_Insert::into('foo')
->row(array('first' => '1', 'second' => '2'))
diff --git a/tests/phpunit/CRM/Utils/SQL/SelectTest.php b/tests/phpunit/CRM/Utils/SQL/SelectTest.php
index ba4d8d29dd24..5cecf42c6e76 100644
--- a/tests/phpunit/CRM/Utils/SQL/SelectTest.php
+++ b/tests/phpunit/CRM/Utils/SQL/SelectTest.php
@@ -5,6 +5,7 @@
* @group headless
*/
class CRM_Utils_SQL_SelectTest extends CiviUnitTestCase {
+
public function testGetDefault() {
$select = CRM_Utils_SQL_Select::from('foo bar');
$this->assertLike('SELECT * FROM foo bar', $select->toSQL());
diff --git a/tests/phpunit/CRM/Utils/SignerTest.php b/tests/phpunit/CRM/Utils/SignerTest.php
index 109f5aaaedbc..51de42931924 100644
--- a/tests/phpunit/CRM/Utils/SignerTest.php
+++ b/tests/phpunit/CRM/Utils/SignerTest.php
@@ -131,11 +131,13 @@ public function testSignValidate() {
);
$cases[] = array(
'signParams' => array(
- 'a' => 1, // int
+ // int
+ 'a' => 1,
'b' => 'bee',
),
'validateParams' => array(
- 'a' => '1', // string
+ // string
+ 'a' => '1',
'b' => 'bee',
),
'isValid' => TRUE,
@@ -144,9 +146,11 @@ public function testSignValidate() {
foreach ($cases as $caseId => $case) {
$signer = new CRM_Utils_Signer('secret', array('a', 'b', 'c'));
$signature = $signer->sign($case['signParams']);
- $this->assertTrue(!empty($signature) && is_string($signature)); // arbitrary
+ // arbitrary
+ $this->assertTrue(!empty($signature) && is_string($signature));
- $validator = new CRM_Utils_Signer('secret', array('a', 'b', 'c')); // same as $signer but physically separate
+ // same as $signer but physically separate
+ $validator = new CRM_Utils_Signer('secret', array('a', 'b', 'c'));
$isValid = $validator->validate($signature, $case['validateParams']);
if ($isValid !== $case['isValid']) {
diff --git a/tests/phpunit/CRM/Utils/StringTest.php b/tests/phpunit/CRM/Utils/StringTest.php
index 472655b06be7..4bc1bd3adee2 100644
--- a/tests/phpunit/CRM/Utils/StringTest.php
+++ b/tests/phpunit/CRM/Utils/StringTest.php
@@ -131,7 +131,8 @@ public function testParsePrefix($input, $defaultPrefix, $expected) {
* @return array
*/
public function booleanDataProvider() {
- $cases = array(); // array(0 => $input, 1 => $expectedOutput)
+ // array(0 => $input, 1 => $expectedOutput)
+ $cases = array();
$cases[] = array(TRUE, TRUE);
$cases[] = array(FALSE, FALSE);
$cases[] = array(1, TRUE);
diff --git a/tests/phpunit/CRM/Utils/SystemTest.php b/tests/phpunit/CRM/Utils/SystemTest.php
index 633abc64ebc6..66bab81091e2 100644
--- a/tests/phpunit/CRM/Utils/SystemTest.php
+++ b/tests/phpunit/CRM/Utils/SystemTest.php
@@ -1,6 +1,5 @@
$parsedUrl,
- 'original' => $url
+ 'original' => $url,
]);
}
catch (CRM_Core_Exception $e) {
@@ -65,7 +64,7 @@ public function testRedirectHook($url, $parsedUrl) {
*
* We do some checks here.
*
- * @param UriInterface $urlQuery
+ * @param \Psr\Http\Message\UriInterface $urlQuery
* @param array $context
*
* @throws \CRM_Core_Exception
@@ -90,7 +89,8 @@ public function getURLs() {
'scheme' => 'https',
'host' => 'example.com',
'query' => 'ab=cd',
- ]],
+ ],
+ ],
['http://myuser:mypass@foo.bar:123/whiz?a=b&c=d', [
'scheme' => 'http',
'host' => 'foo.bar',
@@ -99,10 +99,12 @@ public function getURLs() {
'pass' => 'mypass',
'path' => '/whiz',
'query' => 'a=b&c=d',
- ]],
+ ],
+ ],
['/foo/bar', [
- 'path' => '/foo/bar'
- ]],
+ 'path' => '/foo/bar',
+ ],
+ ],
];
}
diff --git a/tests/phpunit/CRM/Utils/TimeTest.php b/tests/phpunit/CRM/Utils/TimeTest.php
index 2f919def919a..55c647d1bd54 100644
--- a/tests/phpunit/CRM/Utils/TimeTest.php
+++ b/tests/phpunit/CRM/Utils/TimeTest.php
@@ -5,13 +5,15 @@
* @group headless
*/
class CRM_Utils_TimeTest extends CiviUnitTestCase {
+
/**
* Equal cases.
*
* @return array
*/
public function equalCases() {
- $cases = array(); // array(0 => $timeA, 1 => $timeB, 2 => $threshold, 3 => $expectedResult)
+ // array(0 => $timeA, 1 => $timeB, 2 => $threshold, 3 => $expectedResult)
+ $cases = array();
$cases[] = array('2012-04-01 12:00:00', '2012-04-01 12:00:00', 0, 1);
$cases[] = array('2012-04-01 12:00:00', '2012-04-01 12:00:01', 0, 0);
$cases[] = array('2012-04-01 12:00:00', '2012-04-01 12:00:50', 60, 1);
diff --git a/tests/phpunit/CRMTraits/ACL/PermissionTrait.php b/tests/phpunit/CRMTraits/ACL/PermissionTrait.php
index 23826363524e..01a1afd146fa 100644
--- a/tests/phpunit/CRMTraits/ACL/PermissionTrait.php
+++ b/tests/phpunit/CRMTraits/ACL/PermissionTrait.php
@@ -32,7 +32,16 @@
*/
trait CRMTraits_ACL_PermissionTrait {
+ /**
+ * ContactID of allowed Contact
+ * @var int
+ */
protected $allowedContactId = 0;
+
+ /**
+ * Array of allowed contactIds
+ * @var array
+ */
protected $allowedContacts = [];
/**
diff --git a/tests/phpunit/CRMTraits/PCP/PCPTestTrait.php b/tests/phpunit/CRMTraits/PCP/PCPTestTrait.php
index 522a553d415a..17454df59192 100644
--- a/tests/phpunit/CRMTraits/PCP/PCPTestTrait.php
+++ b/tests/phpunit/CRMTraits/PCP/PCPTestTrait.php
@@ -31,6 +31,7 @@
* Traits for testing PCP pages.
*/
trait CRMTraits_PCP_PCPTestTrait {
+
/**
* Build and return pcpBlock params.
*
diff --git a/tests/phpunit/CRMTraits/Page/PageTestTrait.php b/tests/phpunit/CRMTraits/Page/PageTestTrait.php
index 8b2a2f5db322..bf8cc69c1773 100644
--- a/tests/phpunit/CRMTraits/Page/PageTestTrait.php
+++ b/tests/phpunit/CRMTraits/Page/PageTestTrait.php
@@ -122,7 +122,7 @@ protected function assertSmartyVariableArrayIncludes($variableName, $index, $exp
protected function listenForPageContent() {
$this->hookClass->setHook('civicrm_alterContent', [
$this,
- 'checkPageContent'
+ 'checkPageContent',
]);
}
diff --git a/tests/phpunit/Civi/API/KernelTest.php b/tests/phpunit/Civi/API/KernelTest.php
index 00168d5a30d3..995c26dc1740 100644
--- a/tests/phpunit/Civi/API/KernelTest.php
+++ b/tests/phpunit/Civi/API/KernelTest.php
@@ -1,7 +1,7 @@
array('name' => string $eventName, 'type' => string $className))
*/
- var $actualEventSequence;
+ public $actualEventSequence;
/**
- * @var EventDispatcher
+ * @var \Symfony\Component\EventDispatcher\EventDispatcher
*/
- var $dispatcher;
+ public $dispatcher;
/**
* @var Kernel
*/
- var $kernel;
+ public $kernel;
protected function setUp() {
parent::setUp();
diff --git a/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php b/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php
index 3e0a32f47044..0576ddeb53da 100644
--- a/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php
+++ b/tests/phpunit/Civi/API/Subscriber/DynamicFKAuthorizationTest.php
@@ -1,8 +1,8 @@
cronSchedule = array(
'start' => '2015-01-20 00:00:00',
'end' => '2015-03-01 00:00:00',
- 'interval' => 24 * 60 * 60, // seconds
+ // seconds
+ 'interval' => 24 * 60 * 60,
);
$this->schedule = new \CRM_Core_DAO_ActionSchedule();
diff --git a/tests/phpunit/Civi/Angular/ManagerTest.php b/tests/phpunit/Civi/Angular/ManagerTest.php
index abe88a40ee61..2635469a93af 100644
--- a/tests/phpunit/Civi/Angular/ManagerTest.php
+++ b/tests/phpunit/Civi/Angular/ManagerTest.php
@@ -214,7 +214,7 @@ public function testResolveDeps() {
public function hook_civicrm_alterAngular($angular) {
$angular->add(ChangeSet::create('cat-stevens')
->requires('crmMailing', 'crmCatStevens')
- ->alterHtml('~/crmMailing/EditMailingCtrl/2step.html', function(\phpQueryObject $doc){
+ ->alterHtml('~/crmMailing/EditMailingCtrl/2step.html', function(\phpQueryObject $doc) {
$doc->find('[ng-form="crmMailingSubform"]')->attr('cat-stevens', 'ts(\'wild world\')');
})
);
diff --git a/tests/phpunit/Civi/CCase/SequenceListenerTest.php b/tests/phpunit/Civi/CCase/SequenceListenerTest.php
index 01307a59b2ab..72ac7fd51168 100644
--- a/tests/phpunit/Civi/CCase/SequenceListenerTest.php
+++ b/tests/phpunit/Civi/CCase/SequenceListenerTest.php
@@ -84,11 +84,11 @@ public function testSequence() {
//Add an Activity before the case is closed
\CRM_Utils_Time::setTime('2013-11-30 04:00:00');
$this->callApiSuccess('Activity', 'create', array(
- 'activity_name' => 'Follow up',
- 'activity_type_id' => $actTypes['Follow up'],
- 'status_id' => $actStatuses['Scheduled'],
- 'case_id' => $case['id'],
- 'activity_date_time' => \CRM_Utils_Time::getTime(),
+ 'activity_name' => 'Follow up',
+ 'activity_type_id' => $actTypes['Follow up'],
+ 'status_id' => $actStatuses['Scheduled'],
+ 'case_id' => $case['id'],
+ 'activity_date_time' => \CRM_Utils_Time::getTime(),
));
$analyzer->flush();
$this->assertApproxTime('2013-11-30 01:00:00', self::ag($analyzer->getSingleActivity('Medical evaluation'), 'activity_date_time'));
@@ -120,8 +120,8 @@ public function testSequence() {
// Complete the additional Activity; Case closed
\CRM_Utils_Time::setTime('2013-11-30 04:00:00');
$this->callApiSuccess('Activity', 'create', array(
- 'id' => self::ag($analyzer->getSingleActivity('Follow up'), 'id'),
- 'status_id' => $actStatuses['Completed'],
+ 'id' => self::ag($analyzer->getSingleActivity('Follow up'), 'id'),
+ 'status_id' => $actStatuses['Completed'],
));
$analyzer->flush();
$this->assertApproxTime('2013-11-30 01:00:00', self::ag($analyzer->getSingleActivity('Medical evaluation'), 'activity_date_time'));
diff --git a/tests/phpunit/Civi/Core/ResolverTest.php b/tests/phpunit/Civi/Core/ResolverTest.php
index 4c0466a2b530..0f5f3c551ad1 100644
--- a/tests/phpunit/Civi/Core/ResolverTest.php
+++ b/tests/phpunit/Civi/Core/ResolverTest.php
@@ -17,7 +17,8 @@ class ResolverTest extends \CiviUnitTestCase {
* Test setup.
*/
protected function setUp() {
- parent::setUp(); // TODO: Change the autogenerated stub
+ // TODO: Change the autogenerated stub
+ parent::setUp();
$this->resolver = new Resolver();
}
@@ -169,6 +170,7 @@ public function ping($arg1) {
}
namespace {
+
/**
* @param string $arg1
* Dummy value to pass through.
@@ -186,4 +188,5 @@ function civi_core_callback_dummy($arg1) {
function civicrm_api3_resolvertest_ping($params) {
return civicrm_api3_create_success("api dummy received " . $params['first']);
}
+
}
diff --git a/tests/phpunit/Civi/Test/ExampleTransactionalTest.php b/tests/phpunit/Civi/Test/ExampleTransactionalTest.php
index 7c54db29d10e..bf502300311b 100644
--- a/tests/phpunit/Civi/Test/ExampleTransactionalTest.php
+++ b/tests/phpunit/Civi/Test/ExampleTransactionalTest.php
@@ -15,7 +15,7 @@ class ExampleTransactionalTest extends \PHPUnit_Framework_TestCase implements He
* @var array
* Array(int $id).
*/
- static $contactIds = array();
+ protected static $contactIds = array();
public function setUpHeadless() {
return \Civi\Test::headless()->apply();
diff --git a/tests/phpunit/Civi/Token/TokenProcessorTest.php b/tests/phpunit/Civi/Token/TokenProcessorTest.php
index 38d02d44c153..808e490693ce 100644
--- a/tests/phpunit/Civi/Token/TokenProcessorTest.php
+++ b/tests/phpunit/Civi/Token/TokenProcessorTest.php
@@ -8,7 +8,7 @@
class TokenProcessorTest extends \CiviUnitTestCase {
/**
- * @var EventDispatcher
+ * @var \Symfony\Component\EventDispatcher\EventDispatcher
*/
protected $dispatcher;
@@ -154,7 +154,7 @@ public function testFull() {
);
$expectText = array(
- 0 => 'Good morning, What. #0123 is a good number. Trickster {contact.display_name}. Bye!' ,
+ 0 => 'Good morning, What. #0123 is a good number. Trickster {contact.display_name}. Bye!',
1 => 'Good morning, Who. #0004 is a good number. Trickster {contact.display_name}. Bye!',
2 => 'Good morning, Darth Vader. #0010 is a good number. Trickster {contact.display_name}. Bye!',
);
@@ -168,7 +168,8 @@ public function testFull() {
$rowCount++;
}
$this->assertEquals(3, $rowCount);
- $this->assertEquals(0, $this->counts['onListTokens']); // This may change in the future.
+ // This may change in the future.
+ $this->assertEquals(0, $this->counts['onListTokens']);
$this->assertEquals(1, $this->counts['onEvalTokens']);
}
diff --git a/tests/phpunit/CiviTest/CiviCaseTestCase.php b/tests/phpunit/CiviTest/CiviCaseTestCase.php
index f47395e52661..299f5411652b 100644
--- a/tests/phpunit/CiviTest/CiviCaseTestCase.php
+++ b/tests/phpunit/CiviTest/CiviCaseTestCase.php
@@ -51,10 +51,9 @@ public function setUp() {
// & was really hard to troubleshoot as involved truncating option_value table to mitigate this & not leaving DB in a
// state where tests could run afterwards without re-loading.
$this->caseStatusGroup = $this->callAPISuccess('option_group', 'get', array(
- 'name' => 'case_status',
- 'format.only_id' => 1,
- )
- );
+ 'name' => 'case_status',
+ 'format.only_id' => 1,
+ ));
$optionValues = array(
'Medical evaluation' => 'Medical evaluation',
'Mental health evaluation' => "Mental health evaluation",
diff --git a/tests/phpunit/CiviTest/CiviReportTestCase.php b/tests/phpunit/CiviTest/CiviReportTestCase.php
index 641a5f36d74e..84fed16315ba 100644
--- a/tests/phpunit/CiviTest/CiviReportTestCase.php
+++ b/tests/phpunit/CiviTest/CiviReportTestCase.php
@@ -29,6 +29,7 @@
* Class CiviReportTestCase
*/
class CiviReportTestCase extends CiviUnitTestCase {
+
public function setUp() {
parent::setUp();
$this->_sethtmlGlobals();
diff --git a/tests/phpunit/CiviTest/CiviTestSuite.php b/tests/phpunit/CiviTest/CiviTestSuite.php
index 4dd175274b44..43e6150fce6c 100644
--- a/tests/phpunit/CiviTest/CiviTestSuite.php
+++ b/tests/phpunit/CiviTest/CiviTestSuite.php
@@ -119,7 +119,8 @@ protected function addAllTests(
}
// Pass 1: Check all *Tests.php files
- $addTests = array(); // array(callable)
+ // array(callable)
+ $addTests = array();
//echo "start Pass 1 on {$dirInfo->getRealPath()}\n";
$dir = new DirectoryIterator($dirInfo->getRealPath());
foreach ($dir as $fileInfo) {
@@ -155,7 +156,8 @@ protected function addAllTests(
}
// Pass 2: Scan all subdirectories
- $addAllTests = array(); // array(array(0 => $suite, 1 => $file, 2 => SplFileinfo))
+ // array(array(0 => $suite, 1 => $file, 2 => SplFileinfo))
+ $addAllTests = array();
$dir = new DirectoryIterator($dirInfo->getRealPath());
//echo "start Pass 2 on {$dirInfo->getRealPath()}\n";
foreach ($dir as $fileInfo) {
@@ -176,7 +178,8 @@ protected function addAllTests(
// Pass 3: Check all *Test.php files in this directory
//echo "start Pass 3 on {$dirInfo->getRealPath()}\n";
- $addTestSuites = array(); // array(className)
+ // array(className)
+ $addTestSuites = array();
$dir = new DirectoryIterator($dirInfo->getRealPath());
foreach ($dir as $fileInfo) {
if ($fileInfo->isReadable() && $fileInfo->isFile()
diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php
index c3f62042e4d9..39ab293589a2 100644
--- a/tests/phpunit/CiviTest/CiviUnitTestCase.php
+++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php
@@ -78,6 +78,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
/**
* Track tables we have modified during a test.
+ * @var array
*/
protected $_tablesToTruncate = array();
@@ -292,7 +293,8 @@ protected function setUp() {
$session = CRM_Core_Session::singleton();
$session->set('userID', NULL);
- $this->errorScope = CRM_Core_TemporaryErrorScope::useException(); // REVERT
+ // REVERT
+ $this->errorScope = CRM_Core_TemporaryErrorScope::useException();
// Use a temporary file for STDIN
$GLOBALS['stdin'] = tmpfile();
if ($GLOBALS['stdin'] === FALSE) {
@@ -320,7 +322,8 @@ protected function setUp() {
// initialize the object once db is loaded
\Civi::reset();
- $config = CRM_Core_Config::singleton(TRUE, TRUE); // ugh, performance
+ // ugh, performance
+ $config = CRM_Core_Config::singleton(TRUE, TRUE);
// when running unit tests, use mockup user framework
$this->hookClass = CRM_Utils_Hook::singleton();
@@ -815,6 +818,7 @@ public function householdCreate($params = array(), $seq = 0) {
* enum contact type: Individual, Organization
* @param int $seq
* sequence number for the values of this type
+ * @param bool $random
*
* @return array
* properties of sample contact (ie. $params for API call)
@@ -1029,15 +1033,13 @@ public function membershipRenewalDate($durationUnit, $membershipEndDate) {
*/
public function relationshipTypeCreate($params = array()) {
$params = array_merge(array(
- 'name_a_b' => 'Relation 1 for relationship type create',
- 'name_b_a' => 'Relation 2 for relationship type create',
- 'contact_type_a' => 'Individual',
- 'contact_type_b' => 'Organization',
- 'is_reserved' => 1,
- 'is_active' => 1,
- ),
- $params
- );
+ 'name_a_b' => 'Relation 1 for relationship type create',
+ 'name_b_a' => 'Relation 2 for relationship type create',
+ 'contact_type_a' => 'Individual',
+ 'contact_type_b' => 'Organization',
+ 'is_reserved' => 1,
+ 'is_active' => 1,
+ ), $params);
$result = $this->callAPISuccess('relationship_type', 'create', $params);
CRM_Core_PseudoConstant::flush('relationshipType');
@@ -1174,7 +1176,7 @@ public function processorCreate($params = array()) {
* @param array $processorParams
*
* @return \CRM_Core_Payment_Dummy
- * Instance of Dummy Payment Processor
+ * Instance of Dummy Payment Processor
*/
public function dummyProcessorCreate($processorParams = array()) {
$paymentProcessorID = $this->processorCreate($processorParams);
@@ -1628,6 +1630,7 @@ protected function cleanUpAfterACLs() {
$config = CRM_Core_Config::singleton();
unset($config->userPermissionClass->permissions);
}
+
/**
* Create a smart group.
*
@@ -1657,7 +1660,7 @@ public function smartGroupCreate($smartGroupParams = array(), $groupParams = arr
* @param int $totalCount
* @param bool $random
* @return int
- * groupId of created group
+ * groupId of created group
*/
public function groupContactCreate($groupID, $totalCount = 10, $random = FALSE) {
$params = array('group_id' => $groupID);
@@ -1997,7 +2000,6 @@ public function entityCustomGroupWithSingleStringMultiSelectFieldCreate($functio
return array('custom_group_id' => $customGroup['id'], 'custom_field_id' => $customField['id'], 'custom_field_option_group_id' => $custom_field_api_result['values'][0]['option_group_id'], 'custom_field_group_options' => $options);
}
-
/**
* Delete custom group.
*
@@ -2238,6 +2240,7 @@ public function restoreDefaultPriceSetConfig() {
CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_price_field` (`id`, `price_set_id`, `name`, `label`, `html_type`, `is_enter_qty`, `help_pre`, `help_post`, `weight`, `is_display_amounts`, `options_per_line`, `is_active`, `is_required`, `active_on`, `expire_on`, `javascript`, `visibility_id`) VALUES (1, 1, 'contribution_amount', 'Contribution Amount', 'Text', 0, NULL, NULL, 1, 1, 1, 1, 1, NULL, NULL, NULL, 1)");
CRM_Core_DAO::executeQuery("INSERT INTO `civicrm_price_field_value` (`id`, `price_field_id`, `name`, `label`, `description`, `amount`, `count`, `max_value`, `weight`, `membership_type_id`, `membership_num_terms`, `is_default`, `is_active`, `financial_type_id`, `non_deductible_amount`) VALUES (1, 1, 'contribution_amount', 'Contribution Amount', NULL, '1', NULL, NULL, 1, NULL, NULL, 0, 1, 1, 0.00)");
}
+
/*
* Function does a 'Get' on the entity & compares the fields in the Params with those returned
* Default behaviour is to also delete the entity
@@ -2252,6 +2255,7 @@ public function restoreDefaultPriceSetConfig() {
* @param string $errorText
* Text to print on error.
*/
+
/**
* @param array $params
* @param int $id
@@ -2776,26 +2780,25 @@ public function offsetDefaultPriceSet() {
*/
public function paymentProcessorCreate($params = array()) {
$params = array_merge(array(
- 'name' => 'demo',
- 'domain_id' => CRM_Core_Config::domainID(),
- 'payment_processor_type_id' => 'PayPal',
- 'is_active' => 1,
- 'is_default' => 0,
- 'is_test' => 1,
- 'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
- 'password' => '1183377788',
- 'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
- 'url_site' => 'https://www.sandbox.paypal.com/',
- 'url_api' => 'https://api-3t.sandbox.paypal.com/',
- 'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
- 'class_name' => 'Payment_PayPalImpl',
- 'billing_mode' => 3,
- 'financial_type_id' => 1,
- 'financial_account_id' => 12,
- // Credit card = 1 so can pass 'by accident'.
- 'payment_instrument_id' => 'Debit Card',
- ),
- $params);
+ 'name' => 'demo',
+ 'domain_id' => CRM_Core_Config::domainID(),
+ 'payment_processor_type_id' => 'PayPal',
+ 'is_active' => 1,
+ 'is_default' => 0,
+ 'is_test' => 1,
+ 'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
+ 'password' => '1183377788',
+ 'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
+ 'url_site' => 'https://www.sandbox.paypal.com/',
+ 'url_api' => 'https://api-3t.sandbox.paypal.com/',
+ 'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
+ 'class_name' => 'Payment_PayPalImpl',
+ 'billing_mode' => 3,
+ 'financial_type_id' => 1,
+ 'financial_account_id' => 12,
+ // Credit card = 1 so can pass 'by accident'.
+ 'payment_instrument_id' => 'Debit Card',
+ ), $params);
if (!is_numeric($params['payment_processor_type_id'])) {
// really the api should handle this through getoptions but it's not exactly api call so lets just sort it
//here
@@ -2816,18 +2819,16 @@ public function paymentProcessorCreate($params = array()) {
*/
public function setupRecurringPaymentProcessorTransaction($recurParams = [], $contributionParams = []) {
$contributionParams = array_merge([
- 'total_amount' => '200',
- 'invoice_id' => $this->_invoiceID,
- 'financial_type_id' => 'Donation',
- 'contribution_status_id' => 'Pending',
- 'contact_id' => $this->_contactID,
- 'contribution_page_id' => $this->_contributionPageID,
- 'payment_processor_id' => $this->_paymentProcessorID,
- 'is_test' => 0,
- 'skipCleanMoney' => TRUE,
- ],
- $contributionParams
- );
+ 'total_amount' => '200',
+ 'invoice_id' => $this->_invoiceID,
+ 'financial_type_id' => 'Donation',
+ 'contribution_status_id' => 'Pending',
+ 'contact_id' => $this->_contactID,
+ 'contribution_page_id' => $this->_contributionPageID,
+ 'payment_processor_id' => $this->_paymentProcessorID,
+ 'is_test' => 0,
+ 'skipCleanMoney' => TRUE,
+ ], $contributionParams);
$contributionRecur = $this->callAPISuccess('contribution_recur', 'create', array_merge(array(
'contact_id' => $this->_contactID,
'amount' => 1000,
@@ -3127,6 +3128,7 @@ protected function createParticipantWithContribution() {
*
* @param string $component
* @param int $componentId
+ * @param array $priceFieldOptions
*
* @return array
*/
@@ -3393,9 +3395,7 @@ protected function createPaymentInstrument($params = array(), $financialAccountN
'label' => 'Payment Instrument -' . substr(sha1(rand()), 0, 7),
'option_group_id' => 'payment_instrument',
'is_active' => 1,
- ),
- $params
- );
+ ), $params);
$newPaymentInstrument = $this->callAPISuccess('OptionValue', 'create', $params)['id'];
$relationTypeID = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
@@ -3522,36 +3522,33 @@ public function createPriceSetWithPage($entity = NULL, $params = array()) {
'html_type' => 'Radio',
));
$priceFieldValue = $this->callAPISuccess('price_field_value', 'create', array(
- 'price_set_id' => $priceSetID,
- 'price_field_id' => $priceField['id'],
- 'label' => 'Long Haired Goat',
- 'amount' => 20,
- 'financial_type_id' => 'Donation',
- 'membership_type_id' => $membershipTypeID,
- 'membership_num_terms' => 1,
- )
- );
+ 'price_set_id' => $priceSetID,
+ 'price_field_id' => $priceField['id'],
+ 'label' => 'Long Haired Goat',
+ 'amount' => 20,
+ 'financial_type_id' => 'Donation',
+ 'membership_type_id' => $membershipTypeID,
+ 'membership_num_terms' => 1,
+ ));
$this->_ids['price_field_value'] = array($priceFieldValue['id']);
$priceFieldValue = $this->callAPISuccess('price_field_value', 'create', array(
- 'price_set_id' => $priceSetID,
- 'price_field_id' => $priceField['id'],
- 'label' => 'Shoe-eating Goat',
- 'amount' => 10,
- 'financial_type_id' => 'Donation',
- 'membership_type_id' => $membershipTypeID,
- 'membership_num_terms' => 2,
- )
- );
+ 'price_set_id' => $priceSetID,
+ 'price_field_id' => $priceField['id'],
+ 'label' => 'Shoe-eating Goat',
+ 'amount' => 10,
+ 'financial_type_id' => 'Donation',
+ 'membership_type_id' => $membershipTypeID,
+ 'membership_num_terms' => 2,
+ ));
$this->_ids['price_field_value'][] = $priceFieldValue['id'];
$priceFieldValue = $this->callAPISuccess('price_field_value', 'create', array(
- 'price_set_id' => $priceSetID,
- 'price_field_id' => $priceField['id'],
- 'label' => 'Shoe-eating Goat',
- 'amount' => 10,
- 'financial_type_id' => 'Donation',
- )
- );
+ 'price_set_id' => $priceSetID,
+ 'price_field_id' => $priceField['id'],
+ 'label' => 'Shoe-eating Goat',
+ 'amount' => 10,
+ 'financial_type_id' => 'Donation',
+ ));
$this->_ids['price_field_value']['cont'] = $priceFieldValue['id'];
$this->_ids['price_set'] = $priceSetID;
@@ -3613,7 +3610,6 @@ public function onPost($op, $objectName, $objectId, &$objectRef) {
}
}
-
/**
* Instantiate form object.
*
@@ -3662,7 +3658,6 @@ protected function formatMoneyInput($amount) {
return CRM_Utils_Money::format($amount, NULL, '%a');
}
-
/**
* Get the contribution object.
*
diff --git a/tests/phpunit/E2E/Cache/TieredTest.php b/tests/phpunit/E2E/Cache/TieredTest.php
index ac31a41639fa..a2c11fea6098 100644
--- a/tests/phpunit/E2E/Cache/TieredTest.php
+++ b/tests/phpunit/E2E/Cache/TieredTest.php
@@ -35,7 +35,12 @@ class E2E_Cache_TieredTest extends E2E_Cache_CacheTestCase {
/**
* @var CRM_Utils_Cache_ArrayCache
*/
- protected $a, $b;
+ protected $a;
+
+ /**
+ * @var CRM_Utils_Cache_ArrayCache
+ */
+ protected $b;
protected function tearDown() {
if (function_exists('timecop_return')) {
@@ -53,7 +58,7 @@ public function createSimpleCache($maxTimeouts = [86400]) {
$this->b = CRM_Utils_Cache::create([
'name' => 'e2e tiered test b',
'type' => ['ArrayCache'],
- ])
+ ]),
], $maxTimeouts);
}
diff --git a/tests/phpunit/E2E/Cache/TwoInstancesTest.php b/tests/phpunit/E2E/Cache/TwoInstancesTest.php
index 579a8397398f..93e712e327fc 100644
--- a/tests/phpunit/E2E/Cache/TwoInstancesTest.php
+++ b/tests/phpunit/E2E/Cache/TwoInstancesTest.php
@@ -34,7 +34,12 @@ class E2E_Cache_TwoInstancesTest extends CiviEndToEndTestCase {
/**
* @var Psr\SimpleCache\CacheInterface;
*/
- protected $a, $b;
+ protected $a;
+
+ /**
+ * @var Psr\SimpleCache\CacheInterface;
+ */
+ protected $b;
protected function setUp() {
parent::setUp();
diff --git a/tests/phpunit/E2E/Core/AssetBuilderTest.php b/tests/phpunit/E2E/Core/AssetBuilderTest.php
index 5d5766d9acd7..19df9a3c1cd2 100644
--- a/tests/phpunit/E2E/Core/AssetBuilderTest.php
+++ b/tests/phpunit/E2E/Core/AssetBuilderTest.php
@@ -5,7 +5,6 @@
use Civi\Core\AssetBuilder;
use Civi\Core\Event\GenericHookEvent;
-
/**
* Class AssetBuilderTest
* @package E2E\Core
diff --git a/tests/phpunit/E2E/Core/PrevNextTest.php b/tests/phpunit/E2E/Core/PrevNextTest.php
index ed1fdebae63b..97e020865e8f 100644
--- a/tests/phpunit/E2E/Core/PrevNextTest.php
+++ b/tests/phpunit/E2E/Core/PrevNextTest.php
@@ -15,7 +15,12 @@ class PrevNextTest extends \CiviEndToEndTestCase {
/**
* @var string
*/
- protected $cacheKey, $cacheKeyB;
+ protected $cacheKey;
+
+ /**
+ * @var string
+ */
+ protected $cacheKeyB;
/**
* @var \CRM_Core_PrevNextCache_Interface
@@ -313,12 +318,13 @@ public function testDeleteAll() {
$this->assertSelections([], 'getall', $this->cacheKeyB);
}
-
/**
* Assert that the current cacheKey has a list of selected contact IDs.
*
* @param array $ids
* Contact IDs that should be selected.
+ * @param string $action
+ * @param string|NULL $cacheKey
*/
protected function assertSelections($ids, $action = 'get', $cacheKey = NULL) {
if ($cacheKey === NULL) {
diff --git a/tests/phpunit/E2E/Extern/RestTest.php b/tests/phpunit/E2E/Extern/RestTest.php
index 0d9d96315714..a288acc5689e 100644
--- a/tests/phpunit/E2E/Extern/RestTest.php
+++ b/tests/phpunit/E2E/Extern/RestTest.php
@@ -96,104 +96,122 @@ public function apiTestCases() {
// entity,action: omit apiKey, valid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"entity" => "Contact",
"action" => "get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
),
- 1, // is_error
+ // is_error
+ 1,
);
// entity,action: valid apiKey, valid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"entity" => "Contact",
"action" => "get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => self::getApiKey(),
),
- 0, // is_error
+ // is_error
+ 0,
);
// entity,action: bad apiKey, valid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"entity" => "Contact",
"action" => "get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => 'garbage_' . self::getApiKey(),
),
- 1, // is_error
+ // is_error
+ 1,
);
// entity,action: valid apiKey, invalid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"entity" => "Contactses",
"action" => "get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => self::getApiKey(),
),
- 1, // is_error
+ // is_error
+ 1,
);
// q=civicrm/entity/action: omit apiKey, valid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"q" => "civicrm/contact/get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
),
- 1, // is_error
+ // is_error
+ 1,
);
// q=civicrm/entity/action: valid apiKey, valid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"q" => "civicrm/contact/get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => self::getApiKey(),
),
- 0, // is_error
+ // is_error
+ 0,
);
// q=civicrm/entity/action: invalid apiKey, valid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"q" => "civicrm/contact/get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => 'garbage_' . self::getApiKey(),
),
- 1, // is_error
+ // is_error
+ 1,
);
// q=civicrm/entity/action: valid apiKey, invalid entity+action
$cases[] = array(
- array(// query
+ // query
+ array(
"q" => "civicrm/contactses/get",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => self::getApiKey(),
),
- 1, // is_error
+ // is_error
+ 1,
);
// q=civicrm/entity/action: valid apiKey, invalid entity+action
// XXX Actually Ping is valid, no?
$cases[] = array(
- array(// query
+ // query
+ array(
"q" => "civicrm/ping",
"key" => $GLOBALS['_CV']['CIVI_SITE_KEY'],
"json" => "1",
"api_key" => self::getApiKey(),
),
- 0, // is_error
+ // is_error
+ 0,
);
return $cases;
diff --git a/tests/phpunit/E2E/Extern/SoapTest.php b/tests/phpunit/E2E/Extern/SoapTest.php
index 8f556c0364a1..7f618da5a702 100644
--- a/tests/phpunit/E2E/Extern/SoapTest.php
+++ b/tests/phpunit/E2E/Extern/SoapTest.php
@@ -33,7 +33,17 @@ class E2E_Extern_SoapTest extends CiviEndToEndTestCase {
/**
* @var string
*/
- var $url, $adminUser, $adminPass;
+ public $url;
+
+ /**
+ * @var string
+ */
+ public $adminUser;
+
+ /**
+ * @var string
+ */
+ public $adminPass;
public function setUp() {
CRM_Core_Config::singleton(1, 1);
@@ -91,11 +101,10 @@ public function testGetContact() {
*/
protected function createClient() {
return new SoapClient(NULL, array(
- 'location' => $this->url,
- 'uri' => 'urn:civicrm',
- 'trace' => 1,
- )
- );
+ 'location' => $this->url,
+ 'uri' => 'urn:civicrm',
+ 'trace' => 1,
+ ));
}
}
diff --git a/tests/phpunit/EnvTests.php b/tests/phpunit/EnvTests.php
index 9bfa80f8dbf3..18ef4d3a0e08 100644
--- a/tests/phpunit/EnvTests.php
+++ b/tests/phpunit/EnvTests.php
@@ -11,6 +11,7 @@
* (eg "MyFirstTest::testFoo").
*/
class EnvTests extends \PHPUnit_Framework_TestSuite {
+
/**
* @return \EnvTests
*/
diff --git a/tests/phpunit/HelloTest.php b/tests/phpunit/HelloTest.php
index af4b139744e2..74e3ad5bcb26 100644
--- a/tests/phpunit/HelloTest.php
+++ b/tests/phpunit/HelloTest.php
@@ -43,8 +43,11 @@
* Class HelloTest
*/
class HelloTest extends PHPUnit_Framework_TestCase {
- // contains the object handle of the string class
- var $abc;
+ /**
+ * contains the object handle of the string class
+ * @var string
+ */
+ public $abc;
/**
* @param string|null $name
diff --git a/tests/phpunit/api/v3/ACLPermissionTest.php b/tests/phpunit/api/v3/ACLPermissionTest.php
index 1e4e4a5cc2b3..f72b0a8818ff 100644
--- a/tests/phpunit/api/v3/ACLPermissionTest.php
+++ b/tests/phpunit/api/v3/ACLPermissionTest.php
@@ -510,7 +510,8 @@ public static function entities() {
return [
['contribution'],
['participant'],
- ];// @todo array('pledge' => 'pledge')
+ // @todo array('pledge' => 'pledge')
+ ];
}
/**
@@ -684,10 +685,10 @@ public function testGetActivityByAclCannotViewAllContacts() {
],
]);
foreach ([
- 'source_contact',
- 'target_contact',
- 'assignee_contact',
- ] as $roleName) {
+ 'source_contact',
+ 'target_contact',
+ 'assignee_contact',
+ ] as $roleName) {
$roleKey = $roleName . '_id';
if ($role !== $roleKey) {
$this->assertTrue(empty($result[$roleKey]), "Only contact in $role is permissioned to be returned, not $roleKey");
@@ -829,9 +830,8 @@ protected function getActivityContacts($activity) {
$contacts = [];
$activityContacts = $this->callAPISuccess('ActivityContact', 'get', [
- 'activity_id' => $activity['id'],
- ]
- );
+ 'activity_id' => $activity['id'],
+ ]);
$activityRecordTypes = $this->callAPISuccess('ActivityContact', 'getoptions', ['field' => 'record_type_id']);
foreach ($activityContacts['values'] as $activityContact) {
diff --git a/tests/phpunit/api/v3/APIWrapperTest.php b/tests/phpunit/api/v3/APIWrapperTest.php
index d256a294ec09..56c688b9153a 100644
--- a/tests/phpunit/api/v3/APIWrapperTest.php
+++ b/tests/phpunit/api/v3/APIWrapperTest.php
@@ -89,6 +89,7 @@ public function testWrapperHook() {
* Class api_v3_APIWrapperTest_Impl
*/
class api_v3_APIWrapperTest_Impl implements API_Wrapper {
+
/**
* @inheritDoc
*/
diff --git a/tests/phpunit/api/v3/ActivityContactTest.php b/tests/phpunit/api/v3/ActivityContactTest.php
index bbe878d15d55..737f4c0e5dfc 100644
--- a/tests/phpunit/api/v3/ActivityContactTest.php
+++ b/tests/phpunit/api/v3/ActivityContactTest.php
@@ -39,7 +39,6 @@ class api_v3_ActivityContactTest extends CiviUnitTestCase {
protected $_activityID;
protected $_params;
-
public function setUp() {
$this->_apiversion = 3;
parent::setUp();
diff --git a/tests/phpunit/api/v3/ActivityTest.php b/tests/phpunit/api/v3/ActivityTest.php
index 8345c0bdcc7d..6e1b3f602e5b 100644
--- a/tests/phpunit/api/v3/ActivityTest.php
+++ b/tests/phpunit/api/v3/ActivityTest.php
@@ -268,7 +268,6 @@ public function testActivityCreateWithInvalidPriority() {
$this->assertEquals('priority_id', $result['error_field']);
}
-
/**
* Test create succeeds with valid string for priority.
*/
@@ -560,7 +559,6 @@ public function testActivityCreateSupportActivityStatus() {
"'Invalid' is not a valid option for field status_id");
}
-
/**
* Test civicrm_activity_create() with using a text status_id.
*/
@@ -655,7 +653,6 @@ public function testGetFilter() {
$this->callAPISuccess('Activity', 'Delete', array('id' => $result['id']));
}
-
/**
* Test civicrm_activity_get() with filter target_contact_id
*/
@@ -768,7 +765,6 @@ public function testJoinOnTags() {
$this->assertEquals($tagDescription, $activityget['tag_id'][$tag['id']]['tag_id.description']);
}
-
/**
* Test that activity.get api works to filter on and return files.
*/
@@ -1391,15 +1387,13 @@ public function testGetWithOr() {
*/
public function testGetOverdue() {
$overdueAct = $this->callAPISuccess('Activity', 'create', array(
- 'activity_date_time' => 'now - 1 week',
- 'status_id' => 'Scheduled',
- ) + $this->_params
- );
+ 'activity_date_time' => 'now - 1 week',
+ 'status_id' => 'Scheduled',
+ ) + $this->_params);
$completedAct = $this->callAPISuccess('Activity', 'create', array(
- 'activity_date_time' => 'now - 1 week',
- 'status_id' => 'Completed',
- ) + $this->_params
- );
+ 'activity_date_time' => 'now - 1 week',
+ 'status_id' => 'Completed',
+ ) + $this->_params);
$ids = array($overdueAct['id'], $completedAct['id']);
// Test sorting
diff --git a/tests/phpunit/api/v3/AddressTest.php b/tests/phpunit/api/v3/AddressTest.php
index 0307114cccf1..bbbc21cf9a7d 100644
--- a/tests/phpunit/api/v3/AddressTest.php
+++ b/tests/phpunit/api/v3/AddressTest.php
@@ -416,7 +416,8 @@ public function testGetWithJoin() {
public function testCreateAddressStateProvinceIDCorrectForCountry() {
$params = $this->_params;
$params['sequential'] = 1;
- $params['country_id'] = '1228'; // United States country id
+ // United States country id
+ $params['country_id'] = '1228';
$params['state_province_id'] = 'Maryland';
$params['city'] = 'Baltimore';
$params['street_address'] = '600 N Charles St.';
@@ -430,7 +431,8 @@ public function testCreateAddressStateProvinceIDCorrectForCountry() {
// Now try it in Liberia
$params = $this->_params;
$params['sequential'] = 1;
- $params['country_id'] = '1122'; // Liberia country id
+ // Liberia country id
+ $params['country_id'] = '1122';
$params['state_province_id'] = 'Maryland';
$address2 = $this->callAPISuccess('address', 'create', $params);
$this->assertEquals('3497', $address2['values'][0]['state_province_id']);
@@ -466,8 +468,10 @@ public function testCreateAddressSymbolicCountryAndState($inputCountry, $inputSt
'location_type_id' => 1,
'street_address' => '123 Some St',
'city' => 'Hereville',
- 'country_id' => $inputCountry, //'US',
- 'state_province_id' => $inputState, // 'California',
+ //'US',
+ 'country_id' => $inputCountry,
+ // 'California',
+ 'state_province_id' => $inputState,
'postal_code' => '94100',
]);
$created = CRM_Utils_Array::first($r['values']);
diff --git a/tests/phpunit/api/v3/AttachmentTest.php b/tests/phpunit/api/v3/AttachmentTest.php
index 9e313db638d0..9bb5c29dc7e4 100644
--- a/tests/phpunit/api/v3/AttachmentTest.php
+++ b/tests/phpunit/api/v3/AttachmentTest.php
@@ -45,7 +45,6 @@ public static function getFilePrefix() {
return self::$filePrefix;
}
-
protected function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
@@ -64,7 +63,8 @@ protected function tearDown() {
* @return array
*/
public function okCreateProvider() {
- $cases = array(); // array($entityClass, $createParams, $expectedContent)
+ // array($entityClass, $createParams, $expectedContent)
+ $cases = array();
$cases[] = array(
'CRM_Activity_DAO_Activity',
@@ -108,7 +108,8 @@ public function okCreateProvider() {
* @return array
*/
public function badCreateProvider() {
- $cases = array(); // array($entityClass, $createParams, $expectedError)
+ // array($entityClass, $createParams, $expectedError)
+ $cases = array();
$cases[] = array(
'CRM_Activity_DAO_Activity',
@@ -172,7 +173,8 @@ public function badCreateProvider() {
* @return array
*/
public function badUpdateProvider() {
- $cases = array(); // array($entityClass, $createParams, $updateParams, $expectedError)
+ // array($entityClass, $createParams, $updateParams, $expectedError)
+ $cases = array();
$readOnlyFields = array(
'name' => 'newname.txt',
@@ -204,7 +206,8 @@ public function badUpdateProvider() {
* @return array
*/
public function okGetProvider() {
- $cases = array(); // array($getParams, $expectedNames)
+ // array($getParams, $expectedNames)
+ $cases = array();
// Each search runs in a DB which contains these attachments:
// Activity #123: example_123.txt (text/plain) and example_123.csv (text/csv)
@@ -256,7 +259,8 @@ public function okGetProvider() {
* @return array
*/
public function badGetProvider() {
- $cases = array(); // array($getParams, $expectedNames)
+ // array($getParams, $expectedNames)
+ $cases = array();
// Each search runs in a DB which contains these attachments:
// Activity #123: example_123.txt (text/plain) and example_123.csv (text/csv)
@@ -309,9 +313,9 @@ public function testCreate($testEntityClass, $createParams, $expectedContent) {
$this->assertTrue(is_numeric($entity->id));
$createResult = $this->callAPISuccess('Attachment', 'create', $createParams + array(
- 'entity_table' => $entity_table,
- 'entity_id' => $entity->id,
- ));
+ 'entity_table' => $entity_table,
+ 'entity_id' => $entity->id,
+ ));
$fileId = $createResult['id'];
$this->assertTrue(is_numeric($fileId));
$this->assertEquals($entity_table, $createResult['values'][$fileId]['entity_table']);
@@ -355,9 +359,9 @@ public function testCreateFailure($testEntityClass, $createParams, $expectedErro
$this->assertTrue(is_numeric($entity->id));
$createResult = $this->callAPIFailure('Attachment', 'create', $createParams + array(
- 'entity_table' => $entity_table,
- 'entity_id' => $entity->id,
- ));
+ 'entity_table' => $entity_table,
+ 'entity_id' => $entity->id,
+ ));
$this->assertRegExp($expectedError, $createResult['error_message']);
}
@@ -374,15 +378,15 @@ public function testCreateWithBadUpdate($testEntityClass, $createParams, $update
$this->assertTrue(is_numeric($entity->id));
$createResult = $this->callAPISuccess('Attachment', 'create', $createParams + array(
- 'entity_table' => $entity_table,
- 'entity_id' => $entity->id,
- ));
+ 'entity_table' => $entity_table,
+ 'entity_id' => $entity->id,
+ ));
$fileId = $createResult['id'];
$this->assertTrue(is_numeric($fileId));
$updateResult = $this->callAPIFailure('Attachment', 'create', $updateParams + array(
- 'id' => $fileId,
- ));
+ 'id' => $fileId,
+ ));
$this->assertRegExp($expectedError, $updateResult['error_message']);
}
diff --git a/tests/phpunit/api/v3/CaseTest.php b/tests/phpunit/api/v3/CaseTest.php
index 873f37e82910..5e53e3967c56 100644
--- a/tests/phpunit/api/v3/CaseTest.php
+++ b/tests/phpunit/api/v3/CaseTest.php
@@ -380,9 +380,9 @@ public function testCaseGetByActivity() {
// Fetch case based on an activity id
$result = $this->callAPISuccess('case', 'get', array(
- 'activity_id' => $activity,
- 'return' => 'activities',
- ));
+ 'activity_id' => $activity,
+ 'return' => 'activities',
+ ));
$this->assertEquals(FALSE, empty($result['values'][$id]));
$this->assertEquals($result['values'][$id], $case);
}
@@ -400,9 +400,9 @@ public function testCaseGetByContact() {
// Fetch case based on client contact id
$result = $this->callAPISuccess('case', 'get', array(
- 'client_id' => $this->_params['contact_id'],
- 'return' => array('activities', 'contacts'),
- ));
+ 'client_id' => $this->_params['contact_id'],
+ 'return' => array('activities', 'contacts'),
+ ));
$this->assertAPIArrayComparison($result['values'][$id], $case);
}
@@ -419,9 +419,9 @@ public function testCaseGetBySubject() {
// Fetch case based on client contact id
$result = $this->callAPISuccess('case', 'get', array(
- 'subject' => $this->_params['subject'],
- 'return' => array('subject'),
- ));
+ 'subject' => $this->_params['subject'],
+ 'return' => array('subject'),
+ ));
$this->assertAPIArrayComparison($result['values'][$id], $case);
}
@@ -433,9 +433,9 @@ public function testCaseGetByWrongSubject() {
// Append 'wrong' to subject so that it is no longer the same.
$result = $this->callAPISuccess('case', 'get', array(
- 'subject' => $this->_params['subject'] . 'wrong',
- 'return' => array('activities', 'contacts'),
- ));
+ 'subject' => $this->_params['subject'] . 'wrong',
+ 'return' => array('activities', 'contacts'),
+ ));
$this->assertEquals(0, $result['count']);
}
diff --git a/tests/phpunit/api/v3/CaseTypeTest.php b/tests/phpunit/api/v3/CaseTypeTest.php
index 7546c73ac788..9a64c1ce91e8 100644
--- a/tests/phpunit/api/v3/CaseTypeTest.php
+++ b/tests/phpunit/api/v3/CaseTypeTest.php
@@ -127,7 +127,8 @@ public function testCaseTypeCreate_invalidName() {
// Create Case Type
$params = array(
'title' => 'Application',
- 'name' => 'Appl ication', // spaces are not allowed
+ // spaces are not allowed
+ 'name' => 'Appl ication',
'is_active' => 1,
'weight' => 4,
);
@@ -135,7 +136,6 @@ public function testCaseTypeCreate_invalidName() {
$this->callAPIFailure('CaseType', 'create', $params);
}
-
/**
* Test update (create with id) function with valid parameters.
*/
diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php
index a42772938229..818068d0363a 100644
--- a/tests/phpunit/api/v3/ContactTest.php
+++ b/tests/phpunit/api/v3/ContactTest.php
@@ -611,8 +611,8 @@ public function testCreatePreferredLanguageUnset() {
$this->callAPISuccess('Contact', 'create', array(
'first_name' => 'Snoop',
'last_name' => 'Dog',
- 'contact_type' => 'Individual')
- );
+ 'contact_type' => 'Individual',
+ ));
$result = $this->callAPISuccessGetSingle('Contact', array('last_name' => 'Dog'));
$this->assertEquals('en_US', $result['preferred_language']);
}
@@ -637,11 +637,10 @@ public function testCreatePreferredLanguageSet() {
public function testCreatePreferredLanguageNull() {
$this->callAPISuccess('Setting', 'create', array('contact_default_language' => 'null'));
$this->callAPISuccess('Contact', 'create', array(
- 'first_name' => 'Snoop',
- 'last_name' => 'Dog',
- 'contact_type' => 'Individual',
- )
- );
+ 'first_name' => 'Snoop',
+ 'last_name' => 'Dog',
+ 'contact_type' => 'Individual',
+ ));
$result = $this->callAPISuccessGetSingle('Contact', array('last_name' => 'Dog'));
$this->assertEquals(NULL, $result['preferred_language']);
}
@@ -731,7 +730,6 @@ public function testCreateContactCustomFldDateTime() {
$this->callAPISuccess('Contact', 'create', $params);
}
-
/**
* Test creating a current employer through API.
*/
@@ -743,21 +741,18 @@ public function testContactCreateCurrentEmployer() {
));
$this->assertEquals(0, $count);
$employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'current_employer' => 'new employer org',
- )
- ));
+ 'current_employer' => 'new employer org',
+ )));
// do it again as an update to check it doesn't cause an error
$employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'current_employer' => 'new employer org',
- 'id' => $employerResult['id'],
- )
- ));
+ 'current_employer' => 'new employer org',
+ 'id' => $employerResult['id'],
+ )));
$expectedCount = 1;
$this->callAPISuccess('contact', 'getcount', array(
- 'organization_name' => 'new employer org',
- 'contact_type' => 'Organization',
- ),
- $expectedCount);
+ 'organization_name' => 'new employer org',
+ 'contact_type' => 'Organization',
+ ), $expectedCount);
$result = $this->callAPISuccess('contact', 'getsingle', array(
'id' => $employerResult['id'],
@@ -775,8 +770,8 @@ public function testContactCreateCurrentEmployer() {
public function testContactCreateDuplicateCurrentEmployerEnables() {
// Set up - create employer relationship.
$employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'current_employer' => 'new employer org',
- )
+ 'current_employer' => 'new employer org',
+ )
));
$relationship = $this->callAPISuccess('relationship', 'get', array(
'contact_id_a' => $employerResult['id'],
@@ -791,9 +786,9 @@ public function testContactCreateDuplicateCurrentEmployerEnables() {
// Re-set the current employer - thus enabling the relationship.
$this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'current_employer' => 'new employer org',
- 'id' => $employerResult['id'],
- )
+ 'current_employer' => 'new employer org',
+ 'id' => $employerResult['id'],
+ )
));
//check is_active is now 1
$relationship = $this->callAPISuccess('relationship', 'getsingle', array(
@@ -993,7 +988,8 @@ public function testSortLimitChainedRelationshipGetCRM15983() {
'options' => array(
'limit' => '1',
'sort' => 'start_date DESC',
- )),
+ ),
+ ),
);
$get_result = $this->callAPISuccess('contact', 'getsingle', $get_params);
@@ -1047,7 +1043,7 @@ public function testGetByAddresseeID() {
'skip_greeting_processing' => 1,
'addressee_id' => 'null',
'email_greeting_id' => 'null',
- 'postal_greeting_id' => 'null'
+ 'postal_greeting_id' => 'null',
]);
$individual2ID = $this->individualCreate();
@@ -1350,10 +1346,10 @@ public function testDirectionChainingRelationshipsCRM16084() {
// Clean up first.
$this->callAPISuccess('contact', 'delete', array(
'id' => $create_result_1['id'],
- ));
+ ));
$this->callAPISuccess('contact', 'delete', array(
'id' => $create_result_2['id'],
- ));
+ ));
$this->callAPISuccess('contact', 'delete', array(
'id' => $create_result_2['id'],
));
@@ -1569,9 +1565,8 @@ public function testMergeOrganizations() {
$organizationID1 = $this->organizationCreate(array(), 0);
$organizationID2 = $this->organizationCreate(array(), 1);
$contact = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array(
- 'employer_id' => $organizationID1,
- )
- ));
+ 'employer_id' => $organizationID1,
+ )));
$contact = $contact["values"][$contact["id"]];
$membershipType = $this->createEmployerOfMembership();
@@ -1941,7 +1936,6 @@ public function testPseudoFields() {
), $result['preferred_communication_method']);
}
-
/**
* Test birth date parameters.
*
@@ -3807,7 +3801,8 @@ public function testCreateCommunicationStyleUnset() {
$this->callAPISuccess('Contact', 'create', array(
'first_name' => 'John',
'last_name' => 'Doe',
- 'contact_type' => 'Individual')
+ 'contact_type' => 'Individual',
+ )
);
$result = $this->callAPISuccessGetSingle('Contact', array('last_name' => 'Doe'));
$this->assertEquals(1, $result['communication_style_id']);
@@ -3934,37 +3929,43 @@ public function testSmartGroupsForRelatedContacts() {
'contact_id_a' => $c1,
'contact_id_b' => $c2,
'is_active' => 1,
- 'relationship_type_id' => $rtype1['id'], // Child of
+ // Child of
+ 'relationship_type_id' => $rtype1['id'],
));
$this->callAPISuccess('relationship', 'create', array(
'contact_id_a' => $c1,
'contact_id_b' => $h1,
'is_active' => 1,
- 'relationship_type_id' => $rtype2['id'], // Household Member of
+ // Household Member of
+ 'relationship_type_id' => $rtype2['id'],
));
$this->callAPISuccess('relationship', 'create', array(
'contact_id_a' => $c2,
'contact_id_b' => $h1,
'is_active' => 1,
- 'relationship_type_id' => $rtype2['id'], // Household Member of
+ // Household Member of
+ 'relationship_type_id' => $rtype2['id'],
));
$ssParams = array(
'formValues' => array(
- 'display_relationship_type' => $rtype1['id'] . '_a_b', // Child of
+ // Child of
+ 'display_relationship_type' => $rtype1['id'] . '_a_b',
'sort_name' => 'Adams',
),
);
$g1ID = $this->smartGroupCreate($ssParams, array('name' => uniqid(), 'title' => uniqid()));
$ssParams = array(
'formValues' => array(
- 'display_relationship_type' => $rtype2['id'] . '_a_b', // Household Member of
+ // Household Member of
+ 'display_relationship_type' => $rtype2['id'] . '_a_b',
),
);
$g2ID = $this->smartGroupCreate($ssParams, array('name' => uniqid(), 'title' => uniqid()));
$ssParams = array(
'formValues' => array(
- 'display_relationship_type' => $rtype2['id'] . '_b_a', // Household Member is
+ // Household Member is
+ 'display_relationship_type' => $rtype2['id'] . '_b_a',
),
);
// the reverse of g2 which adds another layer for overlap at related contact filter
@@ -4023,7 +4024,7 @@ public function testContactGetWithTag() {
$tags = [];
foreach (['Tag A', 'Tag B'] as $name) {
$tags[] = $this->callApiSuccess('Tag', 'create', [
- 'name' => $name
+ 'name' => $name,
]);
}
@@ -4066,7 +4067,7 @@ public function testContactGetWithTag() {
}
$this->callAPISuccess('Contact', 'delete', [
'id' => $contact['id'],
- 'skip_undelete' => TRUE
+ 'skip_undelete' => TRUE,
]);
}
diff --git a/tests/phpunit/api/v3/ContactTypeTest.php b/tests/phpunit/api/v3/ContactTypeTest.php
index 0219a3e410c4..61fc14926ea9 100644
--- a/tests/phpunit/api/v3/ContactTypeTest.php
+++ b/tests/phpunit/api/v3/ContactTypeTest.php
@@ -110,7 +110,6 @@ public function testContactCreate() {
$this->callAPISuccess('contact', 'delete', $params);
}
-
/**
* Test add with invalid data.
*/
@@ -134,7 +133,6 @@ public function testContactAddInvalidData() {
$contact = $this->callAPIFailure('contact', 'create', $contactParams);
}
-
/**
* Test update with no subtype to valid subtype.
* success expected
@@ -200,7 +198,6 @@ public function testContactUpdateNoSubtypeValid() {
$this->callAPISuccess('contact', 'delete', $params);
}
-
/**
* Test update with no subtype to invalid subtype.
*/
diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php
index e773ba39f0ce..2c663e924fc5 100644
--- a/tests/phpunit/api/v3/ContributionPageTest.php
+++ b/tests/phpunit/api/v3/ContributionPageTest.php
@@ -112,7 +112,8 @@ public function testGetContributionPageByAmount() {
$createResult = $this->callAPISuccess($this->_entity, 'create', $this->params);
$this->id = $createResult['id'];
$getParams = array(
- 'amount' => '' . $this->testAmount, // 3456
+ // 3456
+ 'amount' => '' . $this->testAmount,
'currency' => 'NZD',
'financial_type_id' => 1,
);
@@ -133,7 +134,6 @@ public function testGetFieldsContributionPage() {
$this->assertEquals(12, $result['values']['start_date']['type']);
}
-
/**
* Test form submission with basic price set.
*/
@@ -438,13 +438,11 @@ public function testSubmitMembershipBlockNotSeparatePaymentZeroDollarsWithEmail(
$this->assertCount(1, $msgs);
$mut->checkMailLog(array(
- 'Membership Type: General',
- 'Gruffier',
- ),
- array(
- 'Amount',
- )
- );
+ 'Membership Type: General',
+ 'Gruffier',
+ ), array(
+ 'Amount',
+ ));
$mut->stop();
$mut->clearMessages();
}
@@ -504,7 +502,6 @@ public function testSubmitMembershipBlockIsSeparatePayment() {
$this->assertEquals($membership['contact_id'], $contributions['values'][$membershipPayment['contribution_id']]['contact_id']);
}
-
/**
* Test submit with a membership block in place.
*/
@@ -1277,23 +1274,21 @@ public function testSubmitMembershipPriceSetPaymentPaymentProcessorRecurDelayed(
$membership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id']));
//renew it with processor setting completed - should extend membership
$submitParams = array_merge($submitParams, array(
- 'contact_id' => $contribution['contact_id'],
- 'is_recur' => 1,
- 'frequency_interval' => 1,
- 'frequency_unit' => $this->params['recur_frequency_unit'],
- )
- );
+ 'contact_id' => $contribution['contact_id'],
+ 'is_recur' => 1,
+ 'frequency_interval' => 1,
+ 'frequency_unit' => $this->params['recur_frequency_unit'],
+ ));
$dummyPP->setDoDirectPaymentResult(array('payment_status_id' => 2));
$this->callAPISuccess('contribution_page', 'submit', $submitParams);
$newContribution = $this->callAPISuccess('contribution', 'getsingle', array(
- 'id' => array(
- 'NOT IN' => array($contribution['id']),
- ),
- 'contribution_page_id' => $this->_ids['contribution_page'],
- 'contribution_status_id' => 2,
- )
- );
+ 'id' => array(
+ 'NOT IN' => array($contribution['id']),
+ ),
+ 'contribution_page_id' => $this->_ids['contribution_page'],
+ 'contribution_status_id' => 2,
+ ));
$line = $this->callAPISuccess('line_item', 'getsingle', array('contribution_id' => $newContribution['id']));
$this->assertEquals('civicrm_membership', $line['entity_table']);
$this->assertEquals($membership['id'], $line['entity_id']);
@@ -1339,7 +1334,6 @@ public function testSubmitMembershipIsSeparatePaymentNotRecur() {
$this->assertEmpty($recur['count']);
}
-
/**
* Set up membership contribution page.
* @param bool $isSeparatePayment
@@ -1502,34 +1496,31 @@ public function setUpContributionPage($isRecur = FALSE) {
}
if (empty($this->_ids['price_field_value'])) {
$this->callAPISuccess('price_field_value', 'create', array(
- 'price_set_id' => $priceSetID,
- 'price_field_id' => $priceField['id'],
- 'label' => 'Long Haired Goat',
- 'financial_type_id' => 'Donation',
- 'amount' => 20,
- 'non_deductible_amount' => 15,
- )
- );
+ 'price_set_id' => $priceSetID,
+ 'price_field_id' => $priceField['id'],
+ 'label' => 'Long Haired Goat',
+ 'financial_type_id' => 'Donation',
+ 'amount' => 20,
+ 'non_deductible_amount' => 15,
+ ));
$priceFieldValue = $this->callAPISuccess('price_field_value', 'create', array(
- 'price_set_id' => $priceSetID,
- 'price_field_id' => $priceField['id'],
- 'label' => 'Shoe-eating Goat',
- 'financial_type_id' => 'Donation',
- 'amount' => 10,
- 'non_deductible_amount' => 5,
- )
- );
+ 'price_set_id' => $priceSetID,
+ 'price_field_id' => $priceField['id'],
+ 'label' => 'Shoe-eating Goat',
+ 'financial_type_id' => 'Donation',
+ 'amount' => 10,
+ 'non_deductible_amount' => 5,
+ ));
$this->_ids['price_field_value'] = array($priceFieldValue['id']);
$this->_ids['price_field_value']['cheapskate'] = $this->callAPISuccess('price_field_value', 'create', array(
- 'price_set_id' => $priceSetID,
- 'price_field_id' => $priceField['id'],
- 'label' => 'Stingy Goat',
- 'financial_type_id' => 'Donation',
- 'amount' => 0,
- 'non_deductible_amount' => 0,
- )
- )['id'];
+ 'price_set_id' => $priceSetID,
+ 'price_field_id' => $priceField['id'],
+ 'label' => 'Stingy Goat',
+ 'financial_type_id' => 'Donation',
+ 'amount' => 0,
+ 'non_deductible_amount' => 0,
+ ))['id'];
}
$this->_ids['contribution_page'] = $contributionPageResult['id'];
}
@@ -1544,7 +1535,8 @@ public function setUpMultiIntervalMembershipContributionPage() {
$this->_ids['contribution_page'] = $contributionPage['id'];
$this->_ids['membership_type'] = $this->membershipTypeCreate(array(
- 'auto_renew' => 2, // force auto-renew
+ // force auto-renew
+ 'auto_renew' => 2,
'duration_unit' => 'month',
));
@@ -1696,7 +1688,8 @@ public function testSubmitPledgePaymentPaymentProcessorRecurFuturePayment() {
// Check if contribution created.
$contribution = $this->callAPISuccess('contribution', 'getsingle', array(
'contribution_page_id' => $this->_ids['contribution_page'],
- 'contribution_status_id' => 'Completed', // Will be pending when actual payment processor is used (dummy processor does not support future payments).
+ // Will be pending when actual payment processor is used (dummy processor does not support future payments).
+ 'contribution_status_id' => 'Completed',
));
$this->assertEquals('create_first_success', $contribution['trxn_id']);
@@ -1714,13 +1707,15 @@ public function testSubmitPledgePaymentPaymentProcessorRecurFuturePayment() {
$this->assertEquals($pledgePayment['count'], 3);
$this->assertEquals(date('Ymd', strtotime($pledgePayment['values'][1]['scheduled_date'])), date('Ymd', strtotime("+1 month")));
$this->assertEquals($pledgePayment['values'][1]['scheduled_amount'], 100.00);
- $this->assertEquals($pledgePayment['values'][1]['status_id'], 1); // Will be pending when actual payment processor is used (dummy processor does not support future payments).
+ // Will be pending when actual payment processor is used (dummy processor does not support future payments).
+ $this->assertEquals($pledgePayment['values'][1]['status_id'], 1);
// Check contribution recur record.
$recur = $this->callAPISuccess('contribution_recur', 'getsingle', array('id' => $contribution['contribution_recur_id']));
$this->assertEquals(date('Ymd', strtotime($recur['start_date'])), date('Ymd', strtotime("+1 month")));
$this->assertEquals($recur['amount'], 100.00);
- $this->assertEquals($recur['contribution_status_id'], 5); // In progress status.
+ // In progress status.
+ $this->assertEquals($recur['contribution_status_id'], 5);
}
/**
@@ -1912,7 +1907,6 @@ public function testSubmitContributionPageWithPriceSetQuantity($thousandSeparato
$this->assertEquals($lineItem_TaxAmount, round(180 * 16.95 * 0.10, 2), 'Wrong Sales Tax Amount is calculated and stored.');
}
-
/**
* Test validating a contribution page submit.
*/
diff --git a/tests/phpunit/api/v3/ContributionSoftTest.php b/tests/phpunit/api/v3/ContributionSoftTest.php
index d335202902ee..fe23a9717271 100644
--- a/tests/phpunit/api/v3/ContributionSoftTest.php
+++ b/tests/phpunit/api/v3/ContributionSoftTest.php
@@ -61,7 +61,6 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase {
public $debug = 0;
protected $_params;
-
public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
@@ -148,9 +147,8 @@ public function testGetContributionSoft() {
//test get by contact id works
$result = $this->callAPISuccess('contribution_soft', 'get', array(
- 'contact_id' => $this->_softIndividual2Id,
- )
- );
+ 'contact_id' => $this->_softIndividual2Id,
+ ));
$this->assertEquals(1, $result['count']);
$this->callAPISuccess('contribution_soft', 'Delete', array(
@@ -168,7 +166,6 @@ public function testGetContributionSoft() {
));
}
-
/**
* civicrm_contribution_soft.
*/
diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php
index 9b99b42f9fd6..70d339f05223 100644
--- a/tests/phpunit/api/v3/ContributionTest.php
+++ b/tests/phpunit/api/v3/ContributionTest.php
@@ -34,9 +34,6 @@
*/
class api_v3_ContributionTest extends CiviUnitTestCase {
- /**
- * Assume empty database with just civicrm_data.
- */
protected $_individualId;
protected $_contribution;
protected $_financialTypeId = 1;
@@ -979,7 +976,6 @@ public function testCreateContributionWithFee() {
$this->_checkFinancialRecords($contribution, 'feeAmount');
}
-
/**
* Function tests that additional financial records are created when online contribution is created.
*/
@@ -1188,10 +1184,9 @@ public function testCreateUpdateContributionPayLater() {
$contribution = $this->callAPISuccess('contribution', 'create', $contribParams);
$newParams = array_merge($contribParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 1,
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 1,
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$contribution = $contribution['values'][$contribution['id']];
$this->assertEquals($contribution['contribution_status_id'], '1');
@@ -1215,10 +1210,9 @@ public function testCreateUpdateContributionPaymentInstrument() {
$contribution = $this->callAPISuccess('contribution', 'create', $contribParams);
$newParams = array_merge($contribParams, array(
- 'id' => $contribution['id'],
- 'payment_instrument_id' => $instrumentId,
- )
- );
+ 'id' => $contribution['id'],
+ 'payment_instrument_id' => $instrumentId,
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->assertAPISuccess($contribution);
$this->checkFinancialTrxnPaymentInstrumentChange($contribution['id'], 4, $instrumentId);
@@ -1243,10 +1237,9 @@ public function testCreateUpdateNegativeContributionPaymentInstrument() {
$contribution = $this->callAPISuccess('contribution', 'create', $contribParams);
$newParams = array_merge($contribParams, array(
- 'id' => $contribution['id'],
- 'payment_instrument_id' => $instrumentId,
- )
- );
+ 'id' => $contribution['id'],
+ 'payment_instrument_id' => $instrumentId,
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->assertAPISuccess($contribution);
$this->checkFinancialTrxnPaymentInstrumentChange($contribution['id'], 4, $instrumentId, -100);
@@ -1270,12 +1263,11 @@ public function testCreateUpdateContributionRefund() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$newParams = array_merge($contributionParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 'Refunded',
- 'cancel_date' => '2015-01-01 09:00',
- 'refund_trxn_id' => 'the refund',
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 'Refunded',
+ 'cancel_date' => '2015-01-01 09:00',
+ 'refund_trxn_id' => 'the refund',
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->_checkFinancialTrxn($contribution, 'refund');
@@ -1406,12 +1398,11 @@ public function testCreateUpdateContributionRefundTrxnIDPassedIn() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$newParams = array_merge($contributionParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 'Refunded',
- 'cancel_date' => '2015-01-01 09:00',
- 'trxn_id' => 'the refund',
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 'Refunded',
+ 'cancel_date' => '2015-01-01 09:00',
+ 'trxn_id' => 'the refund',
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->_checkFinancialTrxn($contribution, 'refund');
@@ -1441,13 +1432,12 @@ public function testCreateUpdateContributionRefundRefundAndTrxnIDPassedIn() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$newParams = array_merge($contributionParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 'Refunded',
- 'cancel_date' => '2015-01-01 09:00',
- 'trxn_id' => 'cont id',
- 'refund_trxn_id' => 'the refund',
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 'Refunded',
+ 'cancel_date' => '2015-01-01 09:00',
+ 'trxn_id' => 'cont id',
+ 'refund_trxn_id' => 'the refund',
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->_checkFinancialTrxn($contribution, 'refund');
@@ -1477,13 +1467,12 @@ public function testCreateUpdateContributionRefundRefundNullTrxnIDPassedIn() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contributionParams);
$newParams = array_merge($contributionParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 'Refunded',
- 'cancel_date' => '2015-01-01 09:00',
- 'trxn_id' => 'cont id',
- 'refund_trxn_id' => '',
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 'Refunded',
+ 'cancel_date' => '2015-01-01 09:00',
+ 'trxn_id' => 'cont id',
+ 'refund_trxn_id' => '',
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->_checkFinancialTrxn($contribution, 'refund', NULL, array('trxn_id' => NULL));
@@ -1508,10 +1497,9 @@ public function testCreateUpdateContributionInValidStatusChange() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contribParams);
$newParams = array_merge($contribParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 2,
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 2,
+ ));
$this->callAPIFailure('contribution', 'create', $newParams, ts('Cannot change contribution status from Completed to Pending.'));
}
@@ -1532,11 +1520,10 @@ public function testCreateUpdateContributionCancelPending() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contribParams);
$newParams = array_merge($contribParams, array(
- 'id' => $contribution['id'],
- 'contribution_status_id' => 3,
- 'cancel_date' => '2012-02-02 09:00',
- )
- );
+ 'id' => $contribution['id'],
+ 'contribution_status_id' => 3,
+ 'cancel_date' => '2012-02-02 09:00',
+ ));
//Check if trxn_date is same as cancel_date.
$checkTrxnDate = array(
'trxn_date' => '2012-02-02 09:00:00',
@@ -1561,10 +1548,9 @@ public function testCreateUpdateContributionChangeFinancialType() {
);
$contribution = $this->callAPISuccess('contribution', 'create', $contribParams);
$newParams = array_merge($contribParams, array(
- 'id' => $contribution['id'],
- 'financial_type_id' => 3,
- )
- );
+ 'id' => $contribution['id'],
+ 'financial_type_id' => 3,
+ ));
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->_checkFinancialTrxn($contribution, 'changeFinancial');
$this->_checkFinancialItem($contribution['id'], 'changeFinancial');
@@ -1632,7 +1618,6 @@ public function testCreateUpdateContribution() {
$new_params = array(
'contribution_id' => $contribution['id'],
-
);
$contribution = $this->callAPISuccessGetSingle('contribution', $new_params);
@@ -1652,7 +1637,6 @@ public function testCreateUpdateContribution() {
$params = array(
'contribution_id' => $contributionID,
-
);
$result = $this->callAPISuccess('contribution', 'delete', $params);
$this->assertAPISuccess($result);
@@ -1706,7 +1690,7 @@ public function testUpdateContributionNetAmountVariants() {
$this->callAPISuccess('Contribution', 'create', [
'id' => $contributionID,
- 'payment_instrument' => 'Cash'
+ 'payment_instrument' => 'Cash',
]);
$contribution = $this->callAPISuccessGetSingle('Contribution', [
'id' => $contributionID,
@@ -1734,7 +1718,6 @@ public function testDeleteParamsNotArrayContribution() {
public function testDeleteWrongParamContribution() {
$params = array(
'contribution_source' => 'SSF',
-
);
$this->callAPIFailure('contribution', 'delete', $params);
}
@@ -1770,7 +1753,6 @@ public function testSearchEmptyParams() {
'invoice_id' => 78910,
'source' => 'SSF',
'contribution_status_id' => 1,
-
);
$contribution = $this->callAPISuccess('contribution', 'create', $p);
@@ -1804,7 +1786,6 @@ public function testSearch() {
'financial_type_id' => $this->_financialTypeId,
'non_deductible_amount' => 10.00,
'contribution_status_id' => 1,
-
);
$contribution1 = $this->callAPISuccess('contribution', 'create', $p1);
@@ -1819,13 +1800,11 @@ public function testSearch() {
'fee_amount' => 50.00,
'net_amount' => 60.00,
'contribution_status_id' => 2,
-
);
$contribution2 = $this->callAPISuccess('contribution', 'create', $p2);
$params = array(
'contribution_id' => $contribution2['id'],
-
);
$result = $this->callAPISuccess('contribution', 'get', $params);
$res = $result['values'][$contribution2['id']];
@@ -2007,7 +1986,7 @@ public function testBillingAddress() {
$params = array_merge($this->_params, array(
'contribution_status_id' => 2,
'address_id' => $address['id'],
- )
+ )
);
$contribution = $this->callAPISuccess('contribution', 'create', $params);
$this->callAPISuccess('contribution', 'completetransaction', array(
@@ -2075,14 +2054,14 @@ public function testCheckTaxAmount($thousandSeparator) {
'is_active' => 1,
));
$financialAccount = $this->callAPISuccess('financial_account', 'create', array(
- 'name' => 'Test Tax financial account ',
- 'contact_id' => $contact,
- 'financial_account_type_id' => 2,
- 'is_tax' => 1,
- 'tax_rate' => 5.00,
- 'is_reserved' => 0,
- 'is_active' => 1,
- 'is_default' => 0,
+ 'name' => 'Test Tax financial account ',
+ 'contact_id' => $contact,
+ 'financial_account_type_id' => 2,
+ 'is_tax' => 1,
+ 'tax_rate' => 5.00,
+ 'is_reserved' => 0,
+ 'is_active' => 1,
+ 'is_default' => 0,
));
$financialTypeId = $financialType['id'];
$financialAccountId = $financialAccount['id'];
@@ -2098,9 +2077,9 @@ public function testCheckTaxAmount($thousandSeparator) {
$contribution = $this->callAPISuccess('contribution', 'create', $params);
$contribution1 = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'return' => 'tax_amount', 'sequential' => 1));
$this->callAPISuccess('contribution', 'completetransaction', array(
- 'id' => $contribution['id'],
- 'trxn_id' => '777788888',
- 'fee_amount' => '6.00',
+ 'id' => $contribution['id'],
+ 'trxn_id' => '777788888',
+ 'fee_amount' => '6.00',
));
$contribution2 = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'return' => array('tax_amount', 'fee_amount', 'net_amount'), 'sequential' => 1));
$this->assertEquals($contribution1['values'][0]['tax_amount'], $contribution2['values'][0]['tax_amount']);
@@ -2309,15 +2288,15 @@ public function testRepeatTransactionMembershipRenewCompletedContribution() {
));
$this->callAPISuccess('membership', 'create', array(
- 'id' => $membership['id'],
- 'end_date' => 'yesterday',
- 'status_id' => 'Expired',
+ 'id' => $membership['id'],
+ 'end_date' => 'yesterday',
+ 'status_id' => 'Expired',
));
$contribution = $this->callAPISuccess('contribution', 'repeattransaction', array(
- 'contribution_recur_id' => $originalContribution['values'][1]['contribution_recur_id'],
- 'contribution_status_id' => 'Completed',
- 'trxn_id' => 'bobsled',
+ 'contribution_recur_id' => $originalContribution['values'][1]['contribution_recur_id'],
+ 'contribution_status_id' => 'Completed',
+ 'trxn_id' => 'bobsled',
));
$membershipStatusId = $this->callAPISuccess('membership', 'getvalue', array(
@@ -2710,7 +2689,6 @@ public function testRepeatTransactionUpdatedFinancialTypeAndNotEquals() {
$this->assertEquals($expectedLineItem, $lineItem2['values'][0]);
}
-
/**
* Test completing a transaction does not 'mess' with net amount (CRM-15960).
*/
@@ -2797,6 +2775,7 @@ public function testCompleteTransactionForRecurring() {
$this->mut->stop();
$this->revertTemplateToReservedTemplate();
}
+
/**
* CRM-19710 - Test to ensure that completetransaction respects the input for is_email_receipt setting.
*
@@ -3036,8 +3015,8 @@ public function testCompleteTransactionWithParticipantRecord() {
$this->_individualId = $this->createLoggedInUser();
$contributionID = $this->createPendingParticipantContribution();
$this->callAPISuccess('contribution', 'completetransaction', array(
- 'id' => $contributionID,
- )
+ 'id' => $contributionID,
+ )
);
$participantStatus = $this->callAPISuccessGetValue('participant', array(
'id' => $this->_ids['participant'],
@@ -3069,7 +3048,8 @@ public function testCompleteTransactionMembershipPriceSet() {
$this->createPriceSetWithPage('membership');
$stateOfGrace = $this->callAPISuccess('MembershipStatus', 'getvalue', array(
'name' => 'Grace',
- 'return' => 'id')
+ 'return' => 'id',
+ )
);
$this->setUpPendingContribution($this->_ids['price_field_value'][0]);
$membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership']));
@@ -3249,6 +3229,7 @@ public function cleanUpAfterPriceSets() {
* Set up a pending transaction with a specific price field id.
*
* @param int $priceFieldValueID
+ * @param array $contriParams
*/
public function setUpPendingContribution($priceFieldValueID, $contriParams = array()) {
$contactID = $this->individualCreate();
@@ -3298,18 +3279,16 @@ public function testSendMail() {
$mut = new CiviMailUtils($this, TRUE);
$contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$this->callAPISuccess('contribution', 'sendconfirmation', array(
- 'id' => $contribution['id'],
- 'receipt_from_email' => 'api@civicrm.org',
- )
- );
+ 'id' => $contribution['id'],
+ 'receipt_from_email' => 'api@civicrm.org',
+ ));
$mut->checkMailLog(array(
- '$ 100.00',
- 'Contribution Information',
- 'Please print this confirmation for your records',
- ), array(
- 'Event',
- )
- );
+ '$ 100.00',
+ 'Contribution Information',
+ 'Please print this confirmation for your records',
+ ), array(
+ 'Event',
+ ));
$this->checkCreditCardDetails($mut, $contribution['id']);
$mut->stop();
@@ -3360,10 +3339,9 @@ public function testSendconfirmationPayLater() {
// Create email
try {
civicrm_api3('contribution', 'sendconfirmation', array(
- 'id' => $contribution['id'],
- 'receipt_from_email' => 'api@civicrm.org',
- )
- );
+ 'id' => $contribution['id'],
+ 'receipt_from_email' => 'api@civicrm.org',
+ ));
}
catch (Exception $e) {
// Need to figure out how to stop this some other day
@@ -3377,16 +3355,14 @@ public function testSendconfirmationPayLater() {
// Retrieve mail & check it has the pay_later_receipt info
$mut->getMostRecentEmail('raw');
$mut->checkMailLog(array(
- (string) $contribParams['total_amount'],
- $pageParams['pay_later_receipt'],
- ), array(
- 'Event',
- )
- );
+ (string) $contribParams['total_amount'],
+ $pageParams['pay_later_receipt'],
+ ), array(
+ 'Event',
+ ));
$mut->stop();
}
-
/**
* Check credit card details in sent mail via API
*
@@ -3397,19 +3373,20 @@ public function testSendconfirmationPayLater() {
public function checkCreditCardDetails($mut, $contributionID) {
$contribution = $this->callAPISuccess('contribution', 'create', $this->_params);
$this->callAPISuccess('contribution', 'sendconfirmation', array(
- 'id' => $contributionID,
- 'receipt_from_email' => 'api@civicrm.org',
- 'payment_processor_id' => $this->paymentProcessorID,
- )
- );
+ 'id' => $contributionID,
+ 'receipt_from_email' => 'api@civicrm.org',
+ 'payment_processor_id' => $this->paymentProcessorID,
+ ));
$mut->checkMailLog(array(
- 'Credit Card Information', // credit card header
- 'Billing Name and Address', // billing header
- 'anthony_anderson@civicrm.org', // billing name
- ), array(
- 'Event',
- )
- );
+ // credit card header
+ 'Credit Card Information',
+ // billing header
+ 'Billing Name and Address',
+ // billing name
+ 'anthony_anderson@civicrm.org',
+ ), array(
+ 'Event',
+ ));
}
/**
@@ -3439,17 +3416,15 @@ public function testSendMailEvent() {
'contribution_id' => $contribution['id'],
));
$this->callAPISuccess('contribution', 'sendconfirmation', array(
- 'id' => $contribution['id'],
- 'receipt_from_email' => 'api@civicrm.org',
- )
- );
+ 'id' => $contribution['id'],
+ 'receipt_from_email' => 'api@civicrm.org',
+ ));
$mut->checkMailLog(array(
- 'Annual CiviCRM meet',
- 'Event',
- 'To: "Mr. Anthony Anderson II" Look ma, magic tokens in the markup! Look ma, magic tokens in the markup!