X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FImport%2FImportCiviSeleniumTestCase.php;h=bec67830bbe8314942ae0f11b2b9a4cebed4c90e;hb=7c71caf73155420cbb2d37c4b4eca7485018f499;hp=1390995bfbe2553fb5bab945045be687c7003412;hpb=194589ec517f0e86a7f038eb4ef9db342f3b294d;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php index 1390995bfb..bec67830bb 100644 --- a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php @@ -32,32 +32,23 @@ require_once 'CRM/Utils/Array.php'; */ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { - /* - * Function to test csv import for each component. - * - * @params string $component component name ( Event, Contribution, Membership, Activity etc) - * @params array $headers csv data headers - * @params array $rows csv data rows - * @params string $contactType contact type - * @params string $mode import mode - * @params array $fieldMapper select mapper fields while import - * @params array $other other parameters - * useMappingName : to reuse mapping - - * dateFormat : date format of data - * checkMapperHeaders : to override default check mapper headers - * saveMapping : save current mapping? - * saveMappingName : to override mapping name - * - */ /** - * @param $component - * @param $headers - * @param $rows - * @param string $contactType - * @param string $mode - * @param array $fieldMapper - * @param array $other + * test csv import for each component. + * + * @param string $component component name ( Event, Contribution, Membership, Activity etc) + * @param array $headers csv data headers + * @param array $rows csv data rows + * @param string $contactType contact type + * @param string $mode import mode + * @param array $fieldMapper select mapper fields while import + * @param array $other other parameters + * useMappingName : to reuse mapping + + * dateFormat : date format of data + * checkMapperHeaders : to override default check mapper headers + * saveMapping : save current mapping? + * saveMappingName : to override mapping name + * */ function importCSVComponent($component, $headers, @@ -167,42 +158,32 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { } } - /* - * Function to test contact import. - * - * @params array $headers csv data headers - * @params array $rows csv data rows - * @params string $contactType contact type - * @params string $mode import mode - * @params array $fieldMapper select mapper fields while import - * @params array $other other parameters - * contactSubtype : import for selected Contact Subtype - - * useMappingName : to reuse mapping - * dateFormat : date format of data - * checkMapperHeaders : to override default check mapper headers - * saveMapping : save current mapping? - * saveMappingName : to override mapping name - * createGroup : create new group? - * createGroupName : to override new Group name - * createTag : create new tag? - * createTagName : to override new Tag name - * selectGroup : select existing group for contacts - * selectTag : select existing tag for contacts - * callbackImportSummary : function to override default import summary assertions - * - * @params string $type import type (csv/sql) - * @todo:currently only supports csv, need to work on sql import - - */ /** - * @param $headers - * @param $rows - * @param string $contactType - * @param string $mode - * @param array $fieldMapper - * @param array $other - * @param string $type + * test contact import. + * + * @param array $headers csv data headers + * @param array $rows csv data rows + * @param string $contactType contact type + * @param string $mode import mode + * @param array $fieldMapper select mapper fields while import + * @param array $other other parameters + * contactSubtype : import for selected Contact Subtype + + * useMappingName : to reuse mapping + * dateFormat : date format of data + * checkMapperHeaders : to override default check mapper headers + * saveMapping : save current mapping? + * saveMappingName : to override mapping name + * createGroup : create new group? + * createGroupName : to override new Group name + * createTag : create new tag? + * createTagName : to override new Tag name + * selectGroup : select existing group for contacts + * selectTag : select existing tag for contacts + * callbackImportSummary : function to override default import summary assertions + * + * @param string $type import type (csv/sql) + * @todo:currently only supports csv, need to work on sql import */ function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(), $other = array(), $type = 'csv') { @@ -434,18 +415,11 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { } } - /* - * Helper function to get the import url of the component. - * - * @params string $component component name - * - * @return string import url - - */ /** - * @param $component + * Helper function to get the import url of the component. + * @param string $component component name * - * @return mixed + * @return string import url */ private function _getImportComponentUrl($component) { $importComponentUrl = array( @@ -458,23 +432,16 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { return $importComponentUrl[$component]; } - /* - * Helper function to get the import url of the component. - * - * @params string $component component name - * - * @return string import url - - */ /** * @param $component * @param $contactType * - * @return mixed + * @return string */ function _getImportComponentContactType($component, $contactType) { $importComponentMode = array( - 'Event' => array('Individual' => 'CIVICRM_QFID_1_8', + 'Event' => array( + 'Individual' => 'CIVICRM_QFID_1_8', 'Household' => 'CIVICRM_QFID_2_10', 'Organization' => 'CIVICRM_QFID_4_12', ), @@ -493,22 +460,15 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { return $importComponentMode[$component][$contactType]; } - /* - * Helper function to check import mapping fields. - * - * @params array $headers field headers - * @params array $rows field rows - * @params array $checkMapperHeaders override default mapper headers - */ /** - * @param $headers - * @param $rows + * Helper function to check import mapping fields. + * @param array $headers + * @param array $rows * @param null $existingMapping * @param array $checkMapperHeaders * @param string $headerSelector */ - function _checkImportMapperData($headers, $rows, $existingMapping = NULL, $checkMapperHeaders = array( - ), $headerSelector = 'th') { + function _checkImportMapperData($headers, $rows, $existingMapping = NULL, $checkMapperHeaders = array(), $headerSelector = 'th') { if (empty($checkMapperHeaders)) { $checkMapperHeaders = array( @@ -541,20 +501,13 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { } } - /* - * Helper function to get imported contact ids. - * - * @params array $rows fields rows - * @params string $contactType contact type - - * - * @return array $contactIds imported contact ids - */ /** - * @param $rows + * Helper function to get imported contact ids. + * + * @param array $rows * @param string $contactType * - * @return array + * @return array $contactIds imported contact ids */ function _getImportedContactIds($rows, $contactType = 'Individual') { $contactIds = array(); @@ -594,15 +547,11 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { return $contactIds; } - /* - * Helper function to format headers and rows for contact relationship data. - * - * @params array $headers data headers - * @params string $rows data rows - */ /** - * @param $headers - * @param $rows + * Helper function to format headers and rows for contact relationship data. + * + * @param array $headers + * @param array $rows */ function _formatContactCSVdata(&$headers, &$rows) { if (!isset($headers['contact_relationships'])) {