Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dev/core#644) Add in unit test showing backend able to handle user e… #13408

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion tests/phpunit/CRM/Contribute/Form/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
protected $_params;
protected $_ids = array();
protected $_pageParams = array();
protected $_userId;

/**
* Parameters to create payment processor.
Expand Down Expand Up @@ -94,7 +95,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->createLoggedInUser();
$this->_userId = $this->createLoggedInUser();

$this->_individualId = $this->individualCreate();
$this->_params = array(
Expand Down Expand Up @@ -625,6 +626,33 @@ public function testSubmitEmailReceipt() {
$mut->stop();
}

/**
* Test the submit function on the contribution page using numerical from email address.
*/
public function testSubmitEmailReceiptUserEmailFromAddress() {
$form = new CRM_Contribute_Form_Contribution();
$mut = new CiviMailUtils($this, TRUE);
$email = $this->callAPISuccess('Email', 'create', [
'contact_id' => $this->_userId,
'email' => 'testLoggedIn@example.com',
]);
$form->testSubmit(array(
'total_amount' => 50,
'financial_type_id' => 1,
'contact_id' => $this->_individualId,
'is_email_receipt' => TRUE,
'from_email_address' => $email['id'],
'contribution_status_id' => 1,
), CRM_Core_Action::ADD);
$this->callAPISuccessGetCount('Contribution', array('contact_id' => $this->_individualId), 1);
$mut->checkMailLog(array(
'<p>Please print this receipt for your records.</p>',
'<testloggedin@example.com>',
)
);
$mut->stop();
}

/**
* Ensure that price field are shown during pay later/pending Contribution
*/
Expand Down