<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'WebTest/Import/ImportCiviSeleniumTestCase.php';
parent::setUp();
}
- /*
- * Test participant import for Individuals matching on external identifier.
- */
- function testContributionImport() {
+ /**
+ * Test participant import for Individuals matching on external identifier.
+ */
+ public function testContributionImport() {
$this->webtestLogin();
// Get sample import data.
$this->importCSVComponent('Contribution', $headers, $rows, 'Individual', 'Insert new contributions', $fieldMapper);
}
- /*
- * Test membership import for Individuals matching on external identifier.
- */
- function testMemberImportIndividual() {
+ /**
+ * Test membership import for Individuals matching on external identifier.
+ */
+ public function testMemberImportIndividual() {
$this->webtestLogin();
// Get membership import data for Individuals.
$this->importCSVComponent('Membership', $headers, $rows, 'Individual', 'Skip', $fieldMapper);
}
- /*
- * Test participant import for Individuals matching on external identifier.
- */
- function testParticipantImportIndividual() {
+ /**
+ * Test participant import for Individuals matching on external identifier.
+ */
+ public function testParticipantImportIndividual() {
// Log in using webtestLogin() method
$this->webtestLogin();
$this->importCSVComponent('Event', $headers, $rows, 'Individual', 'Skip', $fieldMapper);
}
- /*
- * Helper function to provide data for contribution import for Individual.
- */
/**
+ * Helper function to provide data for contribution import for Individual.
+ *
* @return array
*/
- function _contributionIndividualCSVData() {
- $firstName1 = substr(sha1(rand()), 0, 7);
- $lastName1 = substr(sha1(rand()), 0, 7);
+ public function _contributionIndividualCSVData() {
+ $firstName1 = substr(sha1(rand()), 0, 7);
+ $lastName1 = substr(sha1(rand()), 0, 7);
$externalId1 = substr(sha1(rand()), 0, 4);
$this->_addContact($firstName1, $lastName1, $externalId1);
- $firstName2 = substr(sha1(rand()), 0, 7);
- $lastName2 = substr(sha1(rand()), 0, 7);
+ $firstName2 = substr(sha1(rand()), 0, 7);
+ $lastName2 = substr(sha1(rand()), 0, 7);
$externalId2 = substr(sha1(rand()), 0, 4);
$this->_addContact($firstName2, $lastName2, $externalId2);
$headers = array(
'external_identifier' => 'External Identifier',
'fee_amount' => 'Fee Amount',
- 'financial_type' => 'Financial Type',
+ 'financial_type' => 'Financial Type',
'contribution_status_id' => 'Contribution Status',
'total_amount' => 'Total Amount',
);
array(
'external_identifier' => $externalId1,
'fee_amount' => '200',
- 'financial_type' => 'Donation',
+ 'financial_type' => 'Donation',
'contribution_status_id' => 'Completed',
'total_amount' => '200',
),
array(
'external_identifier' => $externalId2,
'fee_amount' => '400',
- 'financial_type' => 'Donation',
+ 'financial_type' => 'Donation',
'contribution_status_id' => 'Completed',
'total_amount' => '400',
),
);
$fieldMapper = array(
'mapper[0][0]' => 'external_identifier',
- 'mapper[2][0]' => 'financial_type',
+ 'mapper[2][0]' => 'financial_type',
'mapper[4][0]' => 'total_amount',
);
return array($headers, $rows, $fieldMapper);
}
- /*
- * Helper function to provide data for membership import for Individual.
- */
/**
+ * Helper function to provide data for membership import for Individual.
+ *
* @return array
*/
- function _memberIndividualCSVData() {
+ public function _memberIndividualCSVData() {
$memTypeParams = $this->webtestAddMembershipType();
- $firstName1 = substr(sha1(rand()), 0, 7);
- $lastName1 = substr(sha1(rand()), 0, 7);
+ $firstName1 = substr(sha1(rand()), 0, 7);
+ $lastName1 = substr(sha1(rand()), 0, 7);
$externalId1 = substr(sha1(rand()), 0, 4);
$this->_addContact($firstName1, $lastName1, $externalId1);
$startDate1 = date('Y-m-d');
$year = date('Y') - 1;
- $firstName2 = substr(sha1(rand()), 0, 7);
- $lastName2 = substr(sha1(rand()), 0, 7);
+ $firstName2 = substr(sha1(rand()), 0, 7);
+ $lastName2 = substr(sha1(rand()), 0, 7);
$externalId2 = substr(sha1(rand()), 0, 4);
$this->_addContact($firstName2, $lastName2, $externalId2);
return array($headers, $rows, $fieldMapper);
}
- /*
- * Helper function to provide data for participant import for Individual.
- */
/**
+ * Helper function to provide data for participant import for Individual.
+ *
* @return array
*/
- function _participantIndividualCSVData() {
+ public function _participantIndividualCSVData() {
$eventInfo = $this->_addNewEvent();
- $firstName1 = substr(sha1(rand()), 0, 7);
- $lastName1 = substr(sha1(rand()), 0, 7);
+ $firstName1 = substr(sha1(rand()), 0, 7);
+ $lastName1 = substr(sha1(rand()), 0, 7);
$externalId1 = substr(sha1(rand()), 0, 4);
$this->_addContact($firstName1, $lastName1, $externalId1);
- $firstName2 = substr(sha1(rand()), 0, 7);
- $lastName2 = substr(sha1(rand()), 0, 7);
+ $firstName2 = substr(sha1(rand()), 0, 7);
+ $lastName2 = substr(sha1(rand()), 0, 7);
$externalId2 = substr(sha1(rand()), 0, 4);
$this->_addContact($firstName2, $lastName2, $externalId2);
return array($headers, $rows, $fieldMapper);
}
- /*
- * Helper function to add new contact
- *
- * @params $firstName, $lastName, $externalId
- *
- * @return int external id
- */
/**
- * @param $firstName
- * @param $lastName
- * @param $externalId
+ * Helper function to add new contact
+ *
+ * @param string $firstName
+ * @param string $lastName
+ * @param int $externalId
*
- * @return mixed
+ * @return int
+ * external id
*/
- function _addContact($firstName, $lastName, $externalId) {
+ public function _addContact($firstName, $lastName, $externalId) {
$this->openCiviPage('contact/add', 'reset=1&ct=Individual');
//fill in first name
return $externalId;
}
- /*
- * Helper function to add new event
- *
- * @params array $params parameters to create an event
- *
- * @return array $params event details of newly created event
- */
/**
+ * Helper function to add new event
+ *
* @param array $params
*
* @return array
+ * event details of newly created event
*/
- function _addNewEvent($params = array(
- )) {
+ public function _addNewEvent($params = array()) {
if (empty($params)) {
- // We need a payment processor
- $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7);
+ // Use default payment processor
+ $processorName = 'Test Processor';
$this->webtestAddPaymentProcessor($processorName);
// create an event
$this->waitForElementPresent("_qf_Fee_upload-bottom");
$this->click("CIVICRM_QFID_1_is_monetary");
$this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select( "financial_type_id", "value=4" );
+ $this->select("financial_type_id", "value=4");
$counter = 1;
foreach ($params['fee_level'] as $label => $amount) {
// verify event input on info page
// start at Manage Events listing
$this->openCiviPage('event/manage', 'reset=1');
- $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$params['title']);
+ $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $params['title']);
$this->click("_qf_SearchEvent_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
$this->clickLink("link=" . $params['title'], NULL);
return $params;
}
-}
+}