From d177a2a683214f7bd81162ad7bd7f96624d5c457 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 3 Feb 2015 19:40:20 +1300 Subject: [PATCH] a few phpcs fixups --- tests/phpunit/api/v3/APIStandardsTest.php | 178 ------------------ tests/phpunit/api/v3/APITest.php | 28 ++- tests/phpunit/api/v3/ActivityTest.php | 59 +++--- tests/phpunit/api/v3/ActivityTypeTest.php | 8 +- tests/phpunit/api/v3/AllTests.php | 2 +- tests/phpunit/api/v3/BatchTest.php | 4 +- tests/phpunit/api/v3/CRM11793Test.php | 12 +- tests/phpunit/api/v3/CaseTest.php | 10 +- tests/phpunit/api/v3/ConstantTest.php | 18 +- tests/phpunit/api/v3/ContactTest.php | 24 +-- tests/phpunit/api/v3/ContributionSoftTest.php | 8 +- tests/phpunit/api/v3/ContributionTest.php | 6 +- tests/phpunit/api/v3/CustomFieldTest.php | 2 +- tests/phpunit/api/v3/DashboardContactTest.php | 6 +- tests/phpunit/api/v3/DashboardTest.php | 6 +- tests/phpunit/api/v3/EventTest.php | 22 +-- .../phpunit/api/v3/GroupOrganizationTest.php | 6 +- tests/phpunit/api/v3/MembershipStatusTest.php | 6 +- tests/phpunit/api/v3/MembershipTest.php | 4 +- tests/phpunit/api/v3/OptionValueTest.php | 6 +- .../api/v3/PaymentProcessorTypeTest.php | 2 +- tests/phpunit/api/v3/RelationshipTypeTest.php | 2 +- tests/phpunit/api/v3/UFJoinTest.php | 2 +- tests/phpunit/api/v3/UFMatchTest.php | 2 +- 24 files changed, 127 insertions(+), 296 deletions(-) delete mode 100644 tests/phpunit/api/v3/APIStandardsTest.php diff --git a/tests/phpunit/api/v3/APIStandardsTest.php b/tests/phpunit/api/v3/APIStandardsTest.php deleted file mode 100644 index e8b5ff06db..0000000000 --- a/tests/phpunit/api/v3/APIStandardsTest.php +++ /dev/null @@ -1,178 +0,0 @@ -. - */ - -/** - * Include class definitions - */ -require_once 'CiviTest/CiviUnitTestCase.php'; - -/** - * Test APIv3 civicrm_activity_* functions - * - * @package CiviCRM_APIv3 - * @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir - */ -class api_v3_APIStandardsTest extends CiviUnitTestCase { - - protected $_apiversion; - protected $_apiDir; - protected $_functionFiles; - protected $_regexForGettingAPIStdFunctions; - /* This test case doesn't require DB reset */ - - - public $DBResetRequired = FALSE; - - /** - * Test setup for every test - * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file - */ - public function setUp() { - // Connect to the database - parent::setUp(); - $this->useTransaction(TRUE); - $this->_apiversion = 3; - $this->_apiDir = "../api/v3/"; - $this->_functionFiles = array('Entity.php', 'utils.php'); - - //should possibly insert variable rather than '3' in below - $this->_regexForGettingAPIStdFunctions = '/^civicrm_api3_ #starts with civicrm_api_3 (ignore internal functions) - .*_ #any number of characters up to the last _ - # negative look ahead on string getfields - (?:(?!getfields))/x'; - // functions to skip from utils.php mainly since they get sucked in via - // a require chain in the include files - $this->_skipFunctionList = array( - // location api is deprecated - 'civicrm_api3_location_create', - 'civicrm_api3_location_get', - 'civicrm_api3_location_delete', - // most of these seem to be internal functions - 'civicrm_api3_entity_create', - 'civicrm_api3_entity_delete', - 'civicrm_api3_survey_respondant_count', - // functions from utils.php - 'civicrm_api3_verify_one_mandatory', - 'civicrm_api3_verify_mandatory', - 'civicrm_api3_get_dao', - 'civicrm_api3_create_success', - 'civicrm_api3_create_error', - 'civicrm_api3_error', - 'civicrm_api3_check_contact_dedupe', - 'civicrm_api3_api_check_permission', - ); - } - - /** - * Test checks that all v3 API return a standardised error message when - * the $params passed in is not an array. - */ - public function testParamsNotArray() { - /* @codingStandardsIgnoreStart - * I have commented this out as the check for is_array has been moved to civicrm_api. But keeping in place as - * this test, in contrast to the standards test, tests all existing API rather than just CRUD ones - * so want to keep code for re-use - $files = $this->getAllFilesinAPIDir(); - $this->assertGreaterThan(1, count($files),"something has gone wrong listing the files in line " . __LINE__); - $this->requireOnceFilesArray($files); - $apiStdFunctions = $this->getAllAPIStdFunctions(); - $this->assertGreaterThan(1, count($apiStdFunctions),"something has gone wrong getting the std functions in line " . __LINE__); - $params = 'string'; - foreach ($apiStdFunctions as $key => $function) { - if ( in_array( $function, $this->_skipFunctionList ) ) { - continue; - } - try { - $result = $function($params); - } - catch ( Exception $e ) { - continue; - } - - } - @codingStandardsIgnoreEnd */ - } - - /** - * Get all the files in the API directory for the relevant version which contain API functions - * @return array - * array of php files in the directory excluding helper files - */ - public function getAllFilesinAPIDir() { - $files = array(); - $handle = opendir($this->_apiDir); - - while (($file = readdir($handle)) !== FALSE) { - if (strstr($file, ".php") && - $file != 'Entity.php' && - $file != 'Generic.php' && - $file != 'utils.php' - ) { - $files[] = $file; - } - } - - closedir($handle); - return $files; - } - - /** - * Require once Files - * @param array $files - * list of files to load. - */ - public function requireOnceFilesArray($files) { - foreach ($files as $key => $file) { - require_once $this->_apiDir . $file; - } - } - - /** - * Get all api exposed functions that are expected to conform to standards - * @return array - */ - public function getAllAPIStdFunctions() { - $functionlist = get_defined_functions(); - $functions = preg_grep($this->_regexForGettingAPIStdFunctions, $functionlist['user']); - foreach ($functions as $key => $function) { - if (stristr($function, 'getfields')) { - unset($functions[$key]); - } - if (stristr($function, '_generic_')) { - unset($functions[$key]); - } - } - return $functions; - } - -} diff --git a/tests/phpunit/api/v3/APITest.php b/tests/phpunit/api/v3/APITest.php index 665f8d588d..5c21a9d55a 100644 --- a/tests/phpunit/api/v3/APITest.php +++ b/tests/phpunit/api/v3/APITest.php @@ -69,11 +69,15 @@ class api_v3_APITest extends CiviUnitTestCase { } /** - * test that error doesn't occur for non-existant file + * Test that error doesn't occur for non-existent file. */ public function testAPIWrapperIncludeNoFile() { - - $result = $this->callAPIFailure('RandomFile', 'get', array(), 'API (RandomFile,get) does not exist (join the API team and implement it!)'); + $this->callAPIFailure( + 'RandomFile', + 'get', + array(), + 'API (RandomFile,get) does not exist (join the API team and implement it!)' + ); } public function testAPIWrapperCamelCaseFunction() { @@ -133,7 +137,7 @@ class api_v3_APITest extends CiviUnitTestCase { } /** - * Test that calling via wrapper works + * Test that calling via wrapper works. */ public function testv3Wrapper() { try { @@ -147,11 +151,11 @@ class api_v3_APITest extends CiviUnitTestCase { } /** - * Test exception is thrown + * Test exception is thrown. */ - public function testv3WrapperException() { + public function testV3WrapperException() { try { - $result = civicrm_api3('contact', 'create', array('debug' => 1)); + civicrm_api3('contact', 'create', array('debug' => 1)); } catch (CiviCRM_API3_Exception $e) { $this->assertEquals('mandatory_missing', $e->getErrorCode()); @@ -163,7 +167,10 @@ class api_v3_APITest extends CiviUnitTestCase { $this->fail('Exception was expected'); } - public function testCreate_NoStringNullResult() { + /** + * Test result parsing for null. + */ + public function testCreateNoStringNullResult() { // create an example contact // $contact = CRM_Core_DAO::createTestObject('CRM_Contribute_DAO_ContributionPage')->toArray(); $result = $this->callAPISuccess('ContributionPage', 'create', array( @@ -187,11 +194,12 @@ class api_v3_APITest extends CiviUnitTestCase { 'currency' => '', )); - // check return format + // Check return format. $this->assertEquals(1, $result['count']); foreach ($result['values'] as $resultValue) { $this->assertEquals('New title', $resultValue['title']); - $this->assertEquals('', $resultValue['currency']); // BUG: $resultValue['location'] === 'null' + // BUG: $resultValue['location'] === 'null'. + $this->assertEquals('', $resultValue['currency']); } } diff --git a/tests/phpunit/api/v3/ActivityTest.php b/tests/phpunit/api/v3/ActivityTest.php index 7ffdf55fcf..d1c75590e2 100644 --- a/tests/phpunit/api/v3/ActivityTest.php +++ b/tests/phpunit/api/v3/ActivityTest.php @@ -1,5 +1,6 @@ 'Test activity type', ); - $result = $this->callAPISuccess('activity', 'create', $params); + $this->callAPISuccess('activity', 'create', $params); } /** - * Test civicrm_activity_id() with non-numeric source_contact_id. + * Test civicrm_activity_id() with non-numeric source_contact_id. */ public function testActivityCreateWithNonNumericContactId() { $params = array( @@ -296,7 +297,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_create() with valid parameters - use type_id. + * Test civicrm_activity_create() with valid parameters - use type_id. */ public function testActivityCreateCampaignTypeID() { $this->enableCiviCampaign(); @@ -368,7 +369,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_create() with valid parameters and custom data. + * Test civicrm_activity_create() with valid parameters and custom data. */ public function testActivityCreateCustom() { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); @@ -386,7 +387,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_create() with valid parameters and custom data. + * Test civicrm_activity_create() with valid parameters and custom data. */ public function testActivityCreateCustomContactRefField() { @@ -488,14 +489,14 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_get() with no params + * Test civicrm_activity_get() with no params */ public function testActivityGetEmpty() { $result = $this->callAPISuccess('activity', 'get', array()); } /** - * Test civicrm_activity_get() with a good activity ID + * Test civicrm_activity_get() with a good activity ID */ public function testActivityGetGoodID1() { // Insert rows in civicrm_activity creating activities 4 and @@ -560,7 +561,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { /** - * Test civicrm_activity_get() with filter target_contact_id + * Test civicrm_activity_get() with filter target_contact_id */ public function testActivityGetTargetFilter() { $params = $this->_params; @@ -692,8 +693,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_get() with a good activity ID which - * has associated custom data + * Test civicrm_activity_get() with a good activity ID which + * has associated custom data */ public function testActivityGetGoodIDCustom() { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); @@ -719,8 +720,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_get() with a good activity ID which - * has associated custom data + * Test civicrm_activity_get() with a good activity ID which + * has associated custom data */ public function testActivityGetContact_idCustom() { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); @@ -840,7 +841,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_update() to update an existing activity + * Test civicrm_activity_update() to update an existing activity */ public function testActivityUpdate() { $result = $this->callAPISuccess('activity', 'create', $this->_params); @@ -866,8 +867,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_update() with valid parameters - * and some custom data + * Test civicrm_activity_update() with valid parameters + * and some custom data */ public function testActivityUpdateCustom() { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__); @@ -924,8 +925,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_update() for core activity fields - * and some custom data + * Test civicrm_activity_update() for core activity fields + * and some custom data */ public function testActivityUpdateCheckCoreFields() { $params = $this->_params; @@ -1028,8 +1029,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_update() where the DB has a date_time - * value and there is none in the update params. + * Test civicrm_activity_update() where the DB has a date_time + * value and there is none in the update params. */ public function testActivityUpdateNotDate() { $result = $this->callAPISuccess('activity', 'create', $this->_params); @@ -1074,8 +1075,8 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_update() where the source_contact_id - * is not in the update params. + * Test civicrm_activity_update() where the source_contact_id + * is not in the update params. */ public function testActivityUpdateKeepSource() { $activity = $this->callAPISuccess('activity', 'create', $this->_params); @@ -1097,7 +1098,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { } /** - * Test civicrm_activities_contact_get() + * Test civicrm_activities_contact_get() */ public function testActivitiesContactGet() { $activity = $this->callAPISuccess('activity', 'create', $this->_params); diff --git a/tests/phpunit/api/v3/ActivityTypeTest.php b/tests/phpunit/api/v3/ActivityTypeTest.php index 890e03f32b..7664ec4466 100644 --- a/tests/phpunit/api/v3/ActivityTypeTest.php +++ b/tests/phpunit/api/v3/ActivityTypeTest.php @@ -43,7 +43,7 @@ class api_v3_ActivityTypeTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_type_get() + * Test civicrm_activity_type_get(). */ public function testActivityTypeGet() { $params = array(); @@ -53,7 +53,7 @@ class api_v3_ActivityTypeTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_type_create() + * Test civicrm_activity_type_create(). */ public function testActivityTypeCreate() { $params = array( @@ -68,7 +68,7 @@ class api_v3_ActivityTypeTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_type_create - check id + * Test civicrm_activity_type_create - check id */ public function testActivityTypecreatecheckId() { $params = array( @@ -81,7 +81,7 @@ class api_v3_ActivityTypeTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_type_delete() + * Test civicrm_activity_type_delete() */ public function testActivityTypeDelete() { $params = array( diff --git a/tests/phpunit/api/v3/AllTests.php b/tests/phpunit/api/v3/AllTests.php index 8ddcd46251..bc567a31cc 100644 --- a/tests/phpunit/api/v3/AllTests.php +++ b/tests/phpunit/api/v3/AllTests.php @@ -62,7 +62,7 @@ class api_v3_AllTests extends CiviTestSuite { } /** - * Build test suite dynamically + * Build test suite dynamically */ public static function suite() { $inst = self::getInstance(); diff --git a/tests/phpunit/api/v3/BatchTest.php b/tests/phpunit/api/v3/BatchTest.php index 5ca467eae6..1b0cb06b44 100644 --- a/tests/phpunit/api/v3/BatchTest.php +++ b/tests/phpunit/api/v3/BatchTest.php @@ -47,7 +47,7 @@ class api_v3_BatchTest extends CiviUnitTestCase { } /** - * Create a sample batch + * Create a sample batch. */ public function batchCreate() { $params = $this->_params; @@ -116,7 +116,7 @@ class api_v3_BatchTest extends CiviUnitTestCase { } /** - * Test civicrm_batch_delete using the new $params['id'] syntax + * Test civicrm_batch_delete using the new $params['id'] syntax. */ public function testBatchDeleteCorrectSyntax() { $batchID = $this->batchCreate(); diff --git a/tests/phpunit/api/v3/CRM11793Test.php b/tests/phpunit/api/v3/CRM11793Test.php index 7df9c9cdcc..1fd5571c7d 100644 --- a/tests/phpunit/api/v3/CRM11793Test.php +++ b/tests/phpunit/api/v3/CRM11793Test.php @@ -14,10 +14,10 @@ require_once 'CiviTest/CiviUnitTestCase.php'; class api_v3_CRM11793Test extends CiviUnitTestCase { /** - * Test setup for every test + * Test setup for every test * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file + * Connect to the database, truncate the tables that will be used + * and redirect stdin to a temporary file */ public function setUp() { // Connect to the database @@ -35,10 +35,10 @@ class api_v3_CRM11793Test extends CiviUnitTestCase { } /** - * Test civicrm_contact_create + * Test civicrm_contact_create * - * Verify that attempt to create individual contact with only - * first and last names succeeds + * Verify that attempt to create individual contact with only + * first and last names succeeds */ public function testCRM11793Organization() { $this->_testCRM11793ContactType('Organization'); diff --git a/tests/phpunit/api/v3/CaseTest.php b/tests/phpunit/api/v3/CaseTest.php index 76780b16eb..9e2725eb57 100644 --- a/tests/phpunit/api/v3/CaseTest.php +++ b/tests/phpunit/api/v3/CaseTest.php @@ -45,10 +45,10 @@ class api_v3_CaseTest extends CiviCaseTestCase { protected $followup_activity_type_value; /** - * Test setup for every test + * Test setup for every test * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file + * Connect to the database, truncate the tables that will be used + * and redirect stdin to a temporary file */ public function setUp() { $this->_entity = 'case'; @@ -247,7 +247,7 @@ class api_v3_CaseTest extends CiviCaseTestCase { } /** - * Test activity api create for case activities + * Test activity api create for case activities */ public function testCaseActivityCreate() { // Create a case first @@ -285,7 +285,7 @@ class api_v3_CaseTest extends CiviCaseTestCase { } /** - * Test activity api update for case activities + * Test activity api update for case activities */ public function testCaseActivityUpdate() { // Need to create the case and activity before we can update it diff --git a/tests/phpunit/api/v3/ConstantTest.php b/tests/phpunit/api/v3/ConstantTest.php index ece88d4c7a..cc6cc223a7 100644 --- a/tests/phpunit/api/v3/ConstantTest.php +++ b/tests/phpunit/api/v3/ConstantTest.php @@ -44,10 +44,10 @@ class api_v3_ConstantTest extends CiviUnitTestCase { protected $_apiversion = 3; /** - * Test setup for every test + * Test setup for every test * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file + * Connect to the database, truncate the tables that will be used + * and redirect stdin to a temporary file */ public function setUp() { // Connect to the database @@ -56,7 +56,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_constant_get( ) for unknown constant + * Test civicrm_constant_get( ) for unknown constant */ public function testUnknownConstant() { $result = $this->callAPIFailure('constant', 'get', array( @@ -65,7 +65,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_constant_get( 'activityStatus' ) + * Test civicrm_constant_get( 'activityStatus' ) */ public function testActivityStatus() { @@ -81,7 +81,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_constant_get( 'activityType' ) + * Test civicrm_constant_get( 'activityType' ) */ public function testActivityType() { @@ -95,7 +95,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_address_getoptions( 'location_type_id' ) + * Test civicrm_address_getoptions( 'location_type_id' ) */ public function testLocationTypeGet() { // needed to get rid of cached values from previous tests @@ -113,7 +113,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_phone_getoptions( 'phone_type_id' ) + * Test civicrm_phone_getoptions( 'phone_type_id' ) */ public function testPhoneType() { $params = array( @@ -130,7 +130,7 @@ class api_v3_ConstantTest extends CiviUnitTestCase { } /** - * Test civicrm_constant_get( 'mailProtocol' ) + * Test civicrm_constant_get( 'mailProtocol' ) */ public function testmailProtocol() { $params = array( diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index cb76059f4b..35bc19a9fe 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -53,8 +53,8 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Test setup for every test. * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file + * Connect to the database, truncate the tables that will be used + * and redirect stdin to a temporary file */ public function setUp() { // Connect to the database. @@ -232,7 +232,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { * Test old keys still work. * * Verify that attempt to create individual contact with - * first and last names and old key values works + * first and last names and old key values works */ public function testCreateNameIndividualOldKeys() { $params = array( @@ -257,7 +257,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { * Test preferred keys work. * * Verify that attempt to create individual contact with - * first and last names and old key values works + * first and last names and old key values works */ public function testCreateNameIndividualRecommendedKeys2() { $params = array( @@ -283,7 +283,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { * Test household name is sufficient for create. * * Verify that attempt to create household contact with only - * household name succeeds + * household name succeeds */ public function testCreateNameHousehold() { $params = array( @@ -298,7 +298,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { * Test organization name is sufficient for create. * * Verify that attempt to create organization contact with only - * organization name succeeds. + * organization name succeeds. */ public function testCreateNameOrganization() { $params = array( @@ -797,7 +797,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Verify that attempt to create individual contact with first - * and last names and email succeeds + * and last names and email succeeds */ public function testCreateIndividualWithNameEmail() { $params = array( @@ -826,7 +826,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Verify that attempt to create individual contact with first - * and last names, email and location type succeeds + * and last names, email and location type succeeds */ public function testCreateIndividualWithNameEmailLocationType() { $params = array( @@ -892,7 +892,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Verify that attempt to create household contact with details - * succeeds + * succeeds */ public function testCreateHouseholdDetails() { $params = array( @@ -1132,7 +1132,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Test civicrm_contact_get() return only first name & last name. * - * Use comma separated string return without a space + * Use comma separated string return without a space */ public function testContactGetReturnFirstLastNoComma() { $contact = $this->callAPISuccess('contact', 'create', $this->_params); @@ -1257,7 +1257,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Test birth date params incl value, array & birth_date_high, birth_date_low - * && deceased + * && deceased */ public function testContactGetBirthDate() { $contact1 = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array('birth_date' => 'first day of next month - 2 years'))); @@ -1288,7 +1288,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /** * Test Deceased date params incl value, array & Deceased_date_high, Deceased date_low - * && deceased. + * && deceased. */ public function testContactGetDeceasedDate() { $contact1 = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array('deceased_date' => 'first day of next month - 2 years'))); diff --git a/tests/phpunit/api/v3/ContributionSoftTest.php b/tests/phpunit/api/v3/ContributionSoftTest.php index 01c07100ee..4c0355666a 100644 --- a/tests/phpunit/api/v3/ContributionSoftTest.php +++ b/tests/phpunit/api/v3/ContributionSoftTest.php @@ -281,7 +281,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase { } /** - * civicrm_contribution_soft_delete methods + * civicrm_contribution_soft_delete methods * */ public function testDeleteEmptyParamsContributionSoft() { @@ -316,8 +316,8 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase { ///////////////// civicrm_contribution_search methods /** - * Test civicrm_contribution_search with empty params. - * All available contributions expected. + * Test civicrm_contribution_search with empty params. + * All available contributions expected. */ public function testSearchEmptyParams() { $p = array( @@ -339,7 +339,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase { } /** - * Test civicrm_contribution_soft_search. Success expected. + * Test civicrm_contribution_soft_search. Success expected. */ public function testSearch() { $p1 = array( diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index edaa93a211..dd15e6ce85 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -1208,8 +1208,8 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } /** - * Test civicrm_contribution_search with empty params. - * All available contributions expected. + * Test civicrm_contribution_search with empty params. + * All available contributions expected. */ public function testSearchEmptyParams() { $params = array(); @@ -1250,7 +1250,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } /** - * Test civicrm_contribution_search. Success expected. + * Test civicrm_contribution_search. Success expected. */ public function testSearch() { $p1 = array( diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index de09416c29..6ae4ecfd86 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -204,7 +204,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { } /** - * Test using example code + * Test using example code */ /*function testCustomFieldCreateExample( ) { diff --git a/tests/phpunit/api/v3/DashboardContactTest.php b/tests/phpunit/api/v3/DashboardContactTest.php index 15cfc18e5f..1e448121f3 100644 --- a/tests/phpunit/api/v3/DashboardContactTest.php +++ b/tests/phpunit/api/v3/DashboardContactTest.php @@ -37,10 +37,10 @@ class api_v3_DashboardContactTest extends CiviUnitTestCase { protected $_apiversion = 3; /** - * Test setup for every test + * Test setup for every test * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file + * Connect to the database, truncate the tables that will be used + * and redirect stdin to a temporary file */ public function setUp() { // Connect to the database diff --git a/tests/phpunit/api/v3/DashboardTest.php b/tests/phpunit/api/v3/DashboardTest.php index 41c7988ac1..eb496ddd9e 100644 --- a/tests/phpunit/api/v3/DashboardTest.php +++ b/tests/phpunit/api/v3/DashboardTest.php @@ -37,10 +37,10 @@ class api_v3_DashboardTest extends CiviUnitTestCase { protected $_apiversion = 3; /** - * Test setup for every test + * Test setup for every test * - * Connect to the database, truncate the tables that will be used - * and redirect stdin to a temporary file + * Connect to the database, truncate the tables that will be used + * and redirect stdin to a temporary file */ public function setUp() { // Connect to the database diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index 6b5f19dd90..a627b22c89 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -436,7 +436,7 @@ class api_v3_EventTest extends CiviUnitTestCase { ///////////////// civicrm_event_search methods /** - * Test civicrm_event_search with wrong params type + * Test civicrm_event_search with wrong params type */ public function testSearchWrongParamsType() { $params = 'a string'; @@ -444,23 +444,23 @@ class api_v3_EventTest extends CiviUnitTestCase { } /** - * Test civicrm_event_search with empty params + * Test civicrm_event_search with empty params. */ public function testSearchEmptyParams() { - $event = $this->callAPISuccess('event', 'create', $this->_params[1]); + $this->callAPISuccess('event', 'create', $this->_params[1]); - $getparams = array( + $getParams = array( 'sequential' => 1, ); - $result = $this->callAPISuccess('event', 'get', $getparams); - $this->assertEquals($result['count'], 3, 'In line ' . __LINE__); + $result = $this->callAPISuccess('event', 'get', $getParams); + $this->assertEquals($result['count'], 3); $res = $result['values'][0]; - $this->assertArrayKeyExists('title', $res, 'In line ' . __LINE__); - $this->assertEquals($res['event_type_id'], $this->_params[1]['event_type_id'], 'In line ' . __LINE__); + $this->assertArrayKeyExists('title', $res); + $this->assertEquals($res['event_type_id'], $this->_params[1]['event_type_id']); } /** - * Test civicrm_event_search. Success expected. + * Test civicrm_event_search. Success expected. */ public function testSearch() { $params = array( @@ -476,8 +476,8 @@ class api_v3_EventTest extends CiviUnitTestCase { } /** - * Test civicrm_event_search. Success expected. - * return.offset and return.max_results test (CRM-5266) + * Test civicrm_event_search. Success expected. + * return.offset and return.max_results test (CRM-5266) */ public function testSearchWithOffsetAndMaxResults() { $maxEvents = 5; diff --git a/tests/phpunit/api/v3/GroupOrganizationTest.php b/tests/phpunit/api/v3/GroupOrganizationTest.php index a44a7508af..d152d38083 100644 --- a/tests/phpunit/api/v3/GroupOrganizationTest.php +++ b/tests/phpunit/api/v3/GroupOrganizationTest.php @@ -174,7 +174,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { ///////////////// civicrm_group_organization_remove methods /** - * Test civicrm_group_organization_remove with params not an array. + * Test civicrm_group_organization_remove with params not an array. */ public function testGroupOrganizationDeleteParamsNotArray() { $params = 'delete'; @@ -192,7 +192,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { } /** - * Test civicrm_group_organization_remove with valid params. + * Test civicrm_group_organization_remove with valid params. */ public function testGroupOrganizationDelete() { $paramsC = array( @@ -208,7 +208,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { } /** - * Test civicrm_group_organization_remove with invalid params key. + * Test civicrm_group_organization_remove with invalid params key. */ public function testGroupOrganizationDeleteWithInvalidKey() { $paramsDelete = array( diff --git a/tests/phpunit/api/v3/MembershipStatusTest.php b/tests/phpunit/api/v3/MembershipStatusTest.php index 3149530ef9..0662f58c6b 100644 --- a/tests/phpunit/api/v3/MembershipStatusTest.php +++ b/tests/phpunit/api/v3/MembershipStatusTest.php @@ -59,7 +59,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase { /** - * Test civicrm_membership_status_get with empty params + * Test civicrm_membership_status_get with empty params */ public function testGetEmptyParams() { $result = $this->callAPISuccess('membership_status', 'get', array()); @@ -69,7 +69,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase { } /** - * Test civicrm_membership_status_get. Success expected. + * Test civicrm_membership_status_get. Success expected. */ public function testGet() { $params = array( @@ -80,7 +80,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase { } /** - * Test civicrm_membership_status_get. Success expected. + * Test civicrm_membership_status_get. Success expected. */ public function testGetLimit() { $result = $this->callAPISuccess('membership_status', 'get', array()); diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index 369b6bc855..1d2c007fb1 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -1170,7 +1170,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { /** * Test correct end and start dates are calculated for fixed multi year memberships. * - * The empty start date is calculated to be the start_date (1 Nov prior to the join_date - so 1 Nov 14) + * The empty start date is calculated to be the start_date (1 Nov prior to the join_date - so 1 Nov 14) * * In this set our start date is after the start day and after the rollover day so we do get an extra year * and we end one day before the rollover day. Start day is 1 Nov so we end on 31 Oct @@ -1231,7 +1231,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { /** * Test correct end and start dates are calculated for fixed multi year memberships. * - * The empty start date is calculated to be the start_date (1 Nov prior to the join_date - so 1 Nov 14) + * The empty start date is calculated to be the start_date (1 Nov prior to the join_date - so 1 Nov 14) * * The empty start date is calculated to be the start_date (1 Nov prior to the join_date - so 1 Nov 14) * In this set our join date is after the start day and after the rollover day so we do get an extra year diff --git a/tests/phpunit/api/v3/OptionValueTest.php b/tests/phpunit/api/v3/OptionValueTest.php index c767a2318a..207e8434e0 100644 --- a/tests/phpunit/api/v3/OptionValueTest.php +++ b/tests/phpunit/api/v3/OptionValueTest.php @@ -56,7 +56,7 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { } /** - * Test limit param + * Test limit param */ public function testGetOptionValueLimit() { $params = array(); @@ -68,7 +68,7 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { } /** - * Test offset param + * Test offset param */ public function testGetOptionValueOffSet() { @@ -85,7 +85,7 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { } /** - * Test offset param + * Test offset param */ public function testGetSingleValueOptionValueSort() { $description = "demonstrates use of Sort param (available in many api functions). Also, getsingle"; diff --git a/tests/phpunit/api/v3/PaymentProcessorTypeTest.php b/tests/phpunit/api/v3/PaymentProcessorTypeTest.php index 23a29ab83c..6c65c3c4ef 100644 --- a/tests/phpunit/api/v3/PaymentProcessorTypeTest.php +++ b/tests/phpunit/api/v3/PaymentProcessorTypeTest.php @@ -88,7 +88,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { } /** - * Test using example code + * Test using example code */ public function testPaymentProcessorTypeCreateExample() { require_once 'api/v3/examples/PaymentProcessorType/Create.php'; diff --git a/tests/phpunit/api/v3/RelationshipTypeTest.php b/tests/phpunit/api/v3/RelationshipTypeTest.php index 55a8bed182..7de2155044 100644 --- a/tests/phpunit/api/v3/RelationshipTypeTest.php +++ b/tests/phpunit/api/v3/RelationshipTypeTest.php @@ -128,7 +128,7 @@ class api_v3_RelationshipTypeTest extends CiviUnitTestCase { } /** - * Test using example code + * Test using example code */ public function testRelationshipTypeCreateExample() { require_once 'api/v3/examples/RelationshipType/Create.php'; diff --git a/tests/phpunit/api/v3/UFJoinTest.php b/tests/phpunit/api/v3/UFJoinTest.php index b217000e0f..60d97874a0 100644 --- a/tests/phpunit/api/v3/UFJoinTest.php +++ b/tests/phpunit/api/v3/UFJoinTest.php @@ -209,7 +209,7 @@ class api_v3_UFJoinTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_create() using example code + * Test civicrm_activity_create() using example code. */ public function testUFJoinCreateExample() { require_once 'api/v3/examples/UFJoin/Create.php'; diff --git a/tests/phpunit/api/v3/UFMatchTest.php b/tests/phpunit/api/v3/UFMatchTest.php index 5c084778eb..4f8778a113 100644 --- a/tests/phpunit/api/v3/UFMatchTest.php +++ b/tests/phpunit/api/v3/UFMatchTest.php @@ -116,7 +116,7 @@ class api_v3_UFMatchTest extends CiviUnitTestCase { } /** - * Test civicrm_activity_create() using example code + * Test civicrm_activity_create() using example code */ public function testUFMatchGetExample() { require_once 'api/v3/examples/UFMatch/Get.php'; -- 2.25.1