// Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
// which is where we are after adding Price Set.
- $elements = $this->parseURL();
- $sid = $elements['queryString']['sid'];
+ $sid = $this->urlArg('sid');
$this->assertType('numeric', $sid);
$validStrings = array();
'Pre-conference Meetup?' => 'Radio',
'Evening Sessions' => 'CheckBox',
);
- $this->_testAddPriceFields( $fields, $validateStrings, $financialType );
+ $this->_testAddPriceFields($fields, $validateStrings, $financialType);
// var_dump($validateStrings);
// load the Price Set Preview and check for expected values
$this->select('html_type', "value={$type}");
switch ($type) {
- case 'Text':
- $validateStrings[] = '525.00';
- $this->type('price', '525.00');
- if ($dateSpecificFields == TRUE) {
- $this->webtestFillDateTime('active_on', '+1 week');
- }
- else {
+ case 'Text':
+ $validateStrings[] = '525.00';
+ $this->type('price', '525.00');
+ if ($dateSpecificFields == TRUE) {
+ $this->webtestFillDateTime('active_on', '+1 week');
+ }
+ else {
+ $this->check('is_required');
+ }
+ break;
+
+ case 'Select':
+ $options = array(
+ 1 => array(
+ 'label' => 'Chicken',
+ 'amount' => '30.00',
+ ),
+ 2 => array(
+ 'label' => 'Vegetarian',
+ 'amount' => '25.00',
+ ),
+ );
+ $this->addMultipleChoiceOptions($options, $validateStrings);
+ if ($dateSpecificFields == TRUE) {
+ $this->webtestFillDateTime('expire_on', '-1 week');
+ }
+ break;
+
+ case 'Radio':
+ $options = array(
+ 1 => array(
+ 'label' => 'Yes',
+ 'amount' => '50.00',
+ ),
+ 2 => array(
+ 'label' => 'No',
+ 'amount' => '0',
+ ),
+ );
+ $this->addMultipleChoiceOptions($options, $validateStrings);
$this->check('is_required');
- }
- break;
-
- case 'Select':
- $options = array(
- 1 => array('label' => 'Chicken',
- 'amount' => '30.00',
- ),
- 2 => array(
- 'label' => 'Vegetarian',
- 'amount' => '25.00',
- ),
- );
- $this->addMultipleChoiceOptions($options, $validateStrings);
- if ($dateSpecificFields == TRUE) {
- $this->webtestFillDateTime('expire_on', '-1 week');
- }
- break;
-
- case 'Radio':
- $options = array(
- 1 => array('label' => 'Yes',
- 'amount' => '50.00',
- ),
- 2 => array(
- 'label' => 'No',
- 'amount' => '0',
- ),
- );
- $this->addMultipleChoiceOptions($options, $validateStrings);
- $this->check('is_required');
- if ($dateSpecificFields == TRUE) {
- $this->webtestFillDateTime('active_on', '-1 week');
- }
- break;
-
- case 'CheckBox':
- $options = array(
- 1 => array('label' => 'First Night',
- 'amount' => '15.00',
- ),
- 2 => array(
- 'label' => 'Second Night',
- 'amount' => '15.00',
- ),
- );
- $this->addMultipleChoiceOptions($options, $validateStrings);
- if ($dateSpecificFields == TRUE) {
- $this->webtestFillDateTime('expire_on', '+1 week');
- }
- break;
-
- default:
- break;
+ if ($dateSpecificFields == TRUE) {
+ $this->webtestFillDateTime('active_on', '-1 week');
+ }
+ break;
+
+ case 'CheckBox':
+ $options = array(
+ 1 => array(
+ 'label' => 'First Night',
+ 'amount' => '15.00',
+ ),
+ 2 => array(
+ 'label' => 'Second Night',
+ 'amount' => '15.00',
+ ),
+ );
+ $this->addMultipleChoiceOptions($options, $validateStrings);
+ if ($dateSpecificFields == TRUE) {
+ $this->webtestFillDateTime('expire_on', '+1 week');
+ }
+ break;
+
+ default:
+ break;
}
$this->select('financial_type_id', "label={$financialType}");
$this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom');
}
function _testAddFinancialType() {
- // Add new Financial Account
- $orgName = 'Alberta '.substr(sha1(rand()), 0, 7);
- $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4);
- $financialAccountDescription = "{$financialAccountTitle} Description";
- $accountingCode = 1033;
- $financialAccountType = 'Revenue';
- $taxDeductible = FALSE;
- $isActive = FALSE;
- $isTax = TRUE;
- $taxRate = 9;
- $isDefault = FALSE;
-
- //Add new organisation
- if($orgName) {
- $this->webtestAddOrganization($orgName);
- }
-
- $this->_testAddFinancialAccount($financialAccountTitle,
- $financialAccountDescription,
- $accountingCode,
- $orgName,
- $financialAccountType,
- $taxDeductible,
- $isActive,
- $isTax,
- $taxRate,
- $isDefault
- );
- $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']");
-
//Add new Financial Type
- $financialType['name'] = 'FinancialType '.substr(sha1(rand()), 0, 4);
+ $financialType['name'] = 'FinancialType ' . substr(sha1(rand()), 0, 4);
$financialType['is_deductible'] = TRUE;
$financialType['is_reserved'] = FALSE;
$this->addeditFinancialType($financialType);
-
- $accountRelationship = "Income Account is";
- $expected[] = array('financial_account' => $financialAccountTitle,
-
- 'account_relationship' => $accountRelationship
- );
-
- $this->select('account_relationship', "label={$accountRelationship}");
- // Because it tends to cause problems, all uses of sleep() must be justified in comments
- // Sleep should never be used for wait for anything to load from the server
- // Justification for this instance: FIXME
- sleep(2);
- $this->select('financial_account_id', "label={$financialAccountTitle}");
- $this->click('_qf_FinancialTypeAccount_next');
- $this->waitForPageToLoad($this->getTimeoutMsec());
- $text = 'The financial type Account has been saved.';
- $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text);
return $financialType['name'];
}
// Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
// which is where we are after adding Price Set.
- $elements = $this->parseURL();
- $sid = $elements['queryString']['sid'];
+ $sid = $this->urlArg('sid');
$this->assertType('numeric', $sid);
$validStrings = array();
// Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
// which is where we are after adding Price Set.
- $elements = $this->parseURL();
- $sid = $elements['queryString']['sid'];
+ $sid = $this->urlArg('sid');
$this->assertType('numeric', $sid);
$validStrings = array();
$this->webtestLogin();
//add financial type of account type expense
- $financialType= $this->_testAddFinancialType();
+ $financialType = $this->_testAddFinancialType();
$setTitle = 'Conference Fees - ' . substr(sha1(rand()), 0, 7);
$usedFor = 'Contribution';
// Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
// which is where we are after adding Price Set.
- $elements = $this->parseURL();
- $sid = $elements['queryString']['sid'];
+ $sid = $this->urlArg('sid');
$this->assertType('numeric', $sid);
$validStrings = array();
$this->webtestLogin();
//create a contact and return the contact id
- $firstNameSoft = "John_".substr(sha1(rand()), 0, 5);
- $lastNameSoft = "Doe_".substr(sha1(rand()), 0, 5);
+ $firstNameSoft = "John_" . substr(sha1(rand()), 0, 5);
+ $lastNameSoft = "Doe_" . substr(sha1(rand()), 0, 5);
$this->webtestAddContact($firstNameSoft, $lastNameSoft);
$url = $this->parseURL();
$cid = $url['queryString']['cid'];
// Get the price set id ($sid) by retrieving and parsing the URL of the New Price Field form
// which is where we are after adding Price Set.
- $elements = $this->parseURL();
- $sid = $elements['queryString']['sid'];
+ $sid = $this->urlArg('sid');
$this->assertType('numeric', $sid);
$validStrings = array();
$this->type('trxn_id', 'P20901X1' . rand(100, 10000));
- $this->type('soft_credit_to', "$lastNameSoft, $firstNameSoft");
- $this->click('soft_credit_to');
- $this->waitForElementPresent("css=div.ac_results-inner li");
- $this->click("css=div.ac_results-inner li");
+ $this->webtestFillAutocomplete("{$lastNameSoft}, {$firstNameSoft}", 'soft_credit_contact_1');
+
//Additional Detail section
$this->click('AdditionalDetail');
$this->waitForElementPresent('thankyou_date');
// visit contact summary page
$this->click("css=div.ac_results-inner li");
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->click( 'css=li#tab_contribute a' );
+ $this->click('css=li#tab_contribute a');
$this->waitForElementPresent('link=Record Contribution (Check, Cash, EFT ...)');
$id = explode('id=', $this->getAttribute("xpath=id('rowid')/td[7]/a[text()='View']@href"));
$this->webtestVerifyTabularData($expected);
- $params = array('contribution_id' => $id,
+ $params = array(
+ 'contribution_id' => $id,
'version' => 3,
);
// Retrieve contribution from the DB via api and verify DB values against view contribution page
require_once 'api/api.php';
- $fields = $this->webtest_civicrm_api('contribution','get',$params );
+ $fields = $this->webtest_civicrm_api('contribution', 'get', $params);
$params['id'] = $params['contact_id'] = $fields['values'][$fields['id']]['soft_credit_to'];
$softCreditContact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, TRUE);