From f6c2c37d1a99972ae68eebbe3f71b3f5197ef78a Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 11 Oct 2021 18:23:27 +1300 Subject: [PATCH] Add test for domain, contact tokens in pledge --- tests/phpunit/CRM/Pledge/Form/PledgeTest.php | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/phpunit/CRM/Pledge/Form/PledgeTest.php diff --git a/tests/phpunit/CRM/Pledge/Form/PledgeTest.php b/tests/phpunit/CRM/Pledge/Form/PledgeTest.php new file mode 100644 index 000000000000..2d3a8a61dbbb --- /dev/null +++ b/tests/phpunit/CRM/Pledge/Form/PledgeTest.php @@ -0,0 +1,38 @@ +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'); + } + +}