From bf9a3efff17de49b25f442d38da461292cf255e9 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 27 Apr 2019 14:16:19 +1000 Subject: [PATCH] (NFC) Expand unit test to show off double protocol error Expand test to include situation if the Other protocol is set rather than a specific protocol Make test portable --- tests/phpunit/api/v3/MailingTest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/api/v3/MailingTest.php b/tests/phpunit/api/v3/MailingTest.php index d543a2919c..ba065462bd 100644 --- a/tests/phpunit/api/v3/MailingTest.php +++ b/tests/phpunit/api/v3/MailingTest.php @@ -55,7 +55,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { $this->_params = array( 'subject' => 'Hello {contact.display_name}', 'body_text' => "This is {contact.display_name}.\nhttps://civicrm.org\n{domain.address}{action.optOutUrl}", - 'body_html' => "

This is {contact.display_name}.

CiviCRM.org

{domain.address}{action.optOutUrl}

", + 'body_html' => "

Forward this emailForward this email with no protocolThis is {contact.display_name}.

CiviCRM.org

{domain.address}{action.optOutUrl}

", 'name' => 'mailing name', 'created_id' => $this->_contactID, 'header_id' => '', @@ -269,11 +269,13 @@ class api_v3_MailingTest extends CiviUnitTestCase { $this->assertDBQuery($maxIDs['group'], 'SELECT MAX(id) FROM civicrm_mailing_group'); // 'Preview should not create any mailing_recipient records' $this->assertDBQuery($maxIDs['recipient'], 'SELECT MAX(id) FROM civicrm_mailing_recipients'); - + $baseurl = CRM_Utils_System::baseCMSURL(); $previewResult = $result['values'][$result['id']]['api.Mailing.preview']; $this->assertEquals("Hello $displayName", $previewResult['values']['subject']); $this->assertContains("This is $displayName", $previewResult['values']['body_text']); $this->assertContains("

This is $displayName.

", $previewResult['values']['body_html']); + $this->assertContains('Forward this email with no protocol', $previewResult['values']['body_html']); + $this->assertNotContains("http://http://", $previewResult['values']['body_html']); } public function testMailerPreviewRecipients() { -- 2.25.1