3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | Use of this source code is governed by the AGPL license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Class CRM_Contribute_Form_UpdateSubscriptionTest
15 class CRM_Contribute_Form_UpdateSubscriptionTest
extends CiviUnitTestCase
{
17 use CRMTraits_Contribute_RecurFormsTrait
;
20 * Test the mail sent on update.
22 * @throws \CRM_Core_Exception|\API_Exception
24 public function testMail(): void
{
25 $mut = new CiviMailUtils($this, TRUE);
26 $this->addContribution();
27 /* @var CRM_Contribute_Form_UpdateSubscription $form */
28 $form = $this->getFormObject('CRM_Contribute_Form_UpdateSubscription', ['is_notify' => TRUE]);
29 $form->set('crid', $this->getContributionRecurID());
34 catch (CRM_Core_Exception_PrematureExitException
$e) {
35 $mut->checkMailLog($this->getExpectedMailStrings());
38 $this->fail('should not be reachable');
42 * Get the strings to check for.
46 public function getExpectedMailStrings(): array {
49 'From: "Bob" <bob@example.org>',
50 'To: Anthony Anderson <anthony_anderson@civicrm.org>',
51 'Subject: Recurring Contribution Update Notification - Mr. Anthony Anderson II',
52 'Return-Path: bob@example.org',
54 'Your recurring contribution has been updated as requested:',
55 'Recurring contribution is for $10.00, every 1 month(s) for 12 installments.',
56 'If you have questions please contact us at "Bob" <bob@example.org>.',