Skip to content

Commit

Permalink
Add test for domain, contact tokens in pledge
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Oct 22, 2021
1 parent 38aaee5 commit f6c2c37
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/phpunit/CRM/Pledge/Form/PledgeTest.php
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');
}

}

0 comments on commit f6c2c37

Please sign in to comment.