Add test for selvsvctransfer, remove from template
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 18 Oct 2021 20:14:09 +0000 (09:14 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 28 Oct 2021 19:30:43 +0000 (08:30 +1300)
tests/phpunit/CRM/Event/Form/SelfSvcTransferTest.php [new file with mode: 0644]
xml/templates/message_templates/participant_transferred_html.tpl

diff --git a/tests/phpunit/CRM/Event/Form/SelfSvcTransferTest.php b/tests/phpunit/CRM/Event/Form/SelfSvcTransferTest.php
new file mode 100644 (file)
index 0000000..5901112
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *  Test CRM_Event_Form_Registration functions.
+ *
+ * @package   CiviCRM
+ * @group headless
+ */
+class CRM_Event_Form_SelfSvcTransferTest extends CiviUnitTestCase {
+
+  /**
+   * Test cancellation.
+   *
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
+   */
+  public function testCancel(): void {
+    $_REQUEST['pid'] = $this->participantCreate(['status_id' => 'Registered']);
+    $_REQUEST['is_backoffice'] = 1;
+    $this->individualCreate(['email' => 'new@example.org']);
+    $mut = new CiviMailUtils($this);
+    /* @var CRM_Event_Form_SelfSvcTransfer $form*/
+    $form = $this->getFormObject('CRM_Event_Form_SelfSvcTransfer', [
+      'email' => 'new@example.org',
+    ]);
+    $form->buildForm();
+    $form->postProcess();
+    $emails = $mut->getAllMessages();
+    $this->assertStringContainsString('Registration Confirmation - Annual CiviCRM meet - Mr. Anthony', $emails[0]);
+    $this->assertStringContainsString('<p>Dear Anthony,</p>    <p>Your Event Registration has been Transferred to Anthony Anderson.</p>', $emails[1]);
+    $this->assertStringContainsString('anthony_anderson@civicrm.org', $emails[1]);
+  }
+
+}
index 5ae769e2db0e40ee0b1027989bc1e2ef0bfb5e44..fa066e1b8e636760500ff4dbca121dbd40d79d6d 100644 (file)
@@ -87,7 +87,7 @@
       {/foreach}
      {/if}
 
-     {if $contact.email}
+     {if '{contact.email}'}
       <tr>
        <th {$headerStyle}>
         {ts}Registered Email{/ts}
@@ -95,7 +95,7 @@
       </tr>
       <tr>
        <td colspan="2" {$valueStyle}>
-        {$contact.email}
+        {contact.email}
        </td>
       </tr>
      {/if}