function testUpdatePendingContribution() {
$this->webtestLogin();
- $firstName = substr(sha1(rand()), 0, 7);
- $lastName = 'Contributor';
- $email = $firstName . "@example.com";
//Offline Pay Later Contribution
- $this->_testOfflineContribution($firstName, $lastName, $email);
+ $contact = $this->_testOfflineContribution();
//Online Pay Later Contribution
- $this->_testOnlineContribution($firstName, $lastName, $email);
+ $this->_testOnlineContribution($contact);
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
- $this->type("sort_name", "$lastName, $firstName");
+ $this->type("sort_name", $contact['sort_name']);
$this->click("_qf_Search_refresh");
$this->waitForPageToLoad($this->getTimeoutMsec());
}
/**
- * @param $firstName
- * @param $lastName
- * @param $email
+ * @return array of contact details
*/
- function _testOfflineContribution($firstName, $lastName, $email) {
+ function _testOfflineContribution() {
// Create a contact to be used as soft creditor
$softCreditFname = substr(sha1(rand()), 0, 7);
$softCreditLname = substr(sha1(rand()), 0, 7);
$this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
// create new contact using dialog
- $this->webtestNewDialogContact($firstName, "Contributor", $email);
+ $contact = $this->createDialogContact();
// select financial type
$this->select( "financial_type_id", "value=1" );
4 => 'Donation',
2 => '100.00',
6 => 'Pending',
- 1 => "{$firstName} Contributor",
+ 1 => $contact['display_name'],
);
foreach ($expected as $value => $label) {
$this->verifyText("xpath=id('Search')/div[2]/table[2]/tbody/tr[2]/td[$value]", preg_quote($label));
}
+ return $contact;
}
/**
- * @param $firstName
- * @param $lastName
- * @param $email
+ * @param array $contact
*/
- function _testOnlineContribution($firstName, $lastName, $email) {
+ function _testOnlineContribution($contact) {
// Use default payment processor
$processorName = 'Test Processor';
$this->webtestLogout();
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
- $this->type("email-5", $email);
+ $this->type("email-5", $contact['email']);
- $this->type("first_name", $firstName);
- $this->type("last_name", $lastName);
+ $this->type("first_name", $contact['first_name']);
+ $this->type("last_name", $contact['last_name']);
$this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input");
$this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100);
//Find Contribution
$this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
- $this->type("sort_name", "$lastName, $firstName");
+ $this->type("sort_name", $contact['sort_name']);
$this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']");
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[2]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
// View Contribution Record and test for expected values
$expected = array(
- 'From' => "{$firstName} {$lastName}",
+ 'From' => $contact['display_name'],
'Financial Type' => 'Donation',
'Total Amount' => '100.00',
'Contribution Status' => 'Pending : Pay Later',