-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for domain, contact tokens in pledge
- Loading branch information
1 parent
38aaee5
commit f6c2c37
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use Civi\Api4\Email; | ||
|
||
/** | ||
* Include dataProvider for tests | ||
* @group headless | ||
*/ | ||
class CRM_Pledge_Form_PledgeTest extends CiviUnitTestCase { | ||
|
||
/** | ||
* Test the post process function. | ||
* | ||
* @throws \API_Exception | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
public function testPostProcess(): void { | ||
$mut = new CiviMailUtils($this); | ||
$loggedInUser = $this->createLoggedInUser(); | ||
$this->swapMessageTemplateForInput('pledge_acknowledge', '{domain.name} {contact.first_name}'); | ||
|
||
$form = $this->getFormObject('CRM_Pledge_Form_Pledge', [ | ||
'amount' => 10, | ||
'installments' => 1, | ||
'contact_id' => $this->individualCreate(), | ||
'is_acknowledge' => 1, | ||
'from_email_address' => Email::get() | ||
->addWhere('contact_id', '=', $loggedInUser) | ||
->addSelect('id')->execute()->first()['id'], | ||
]); | ||
$form->buildForm(); | ||
$form->postProcess(); | ||
$mut->checkAllMailLog(['Default Domain Name Anthony']); | ||
$mut->clearMessages(); | ||
$this->revertTemplateToReservedTemplate('pledge_acknowledge'); | ||
} | ||
|
||
} |