Commit | Line | Data |
---|---|---|
e73cf7de EM |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | Copyright CiviCRM LLC. All rights reserved. | | |
5 | | | | |
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 | +--------------------------------------------------------------------+ | |
10 | */ | |
11 | ||
12 | /** | |
13 | * Class CRM_Contribute_Form_UpdateSubscriptionTest | |
14 | */ | |
15 | class CRM_Contribute_Form_CancelSubscriptionTest extends CRM_Contribute_Form_RecurForms { | |
16 | ||
17 | /** | |
18 | * Test the mail sent on update. | |
19 | * | |
20 | * @throws \CRM_Core_Exception|\API_Exception | |
21 | */ | |
22 | public function testMail(): void { | |
23 | $mut = new CiviMailUtils($this, TRUE); | |
24 | $this->addContribution(); | |
25 | /* @var CRM_Contribute_Form_CancelSubscription $form */ | |
26 | $form = $this->getFormObject('CRM_Contribute_Form_CancelSubscription', ['is_notify' => TRUE]); | |
27 | $form->set('crid', $this->getContributionRecurID()); | |
28 | $form->buildForm(); | |
29 | try { | |
30 | $form->postProcess(); | |
31 | } | |
32 | catch (CRM_Core_Exception_PrematureExitException $e) { | |
33 | $mut->checkMailLog($this->getExpectedMailStrings()); | |
34 | return; | |
35 | } | |
36 | $this->fail('should not be reachable'); | |
37 | } | |
38 | ||
39 | /** | |
40 | * Get the strings to check for. | |
41 | * | |
42 | * @return string[] | |
43 | */ | |
44 | public function getExpectedMailStrings(): array { | |
45 | return [ | |
46 | 'MIME-Version: 1.0', | |
47 | 'From: "Bob" <bob@example.org>', | |
48 | 'To: Anthony Anderson <anthony_anderson@civicrm.org>', | |
49 | "Subject: Recurring Contribution Cancellation Notification - Mr. Anthony\n Anderson II", | |
50 | 'Return-Path: bob@example.org', | |
51 | 'Dear Anthony,', | |
52 | 'Your recurring contribution of $ 10.00, every 1 month has been cancelled as requested', | |
53 | ]; | |
54 | } | |
55 | ||
56 | } |