Skip to content
Snippets Groups Projects
Unverified Commit 1b86b446 authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Merge pull request #14141 from seamuslee001/view_url_double_protocol_test

(NFC) Expand unit test to show off double protocol error
parents 2c409890 bf9a3eff
Branches
Tags
No related merge requests found
......@@ -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' => "<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700' rel='stylesheet' type='text/css'><p>This is {contact.display_name}.</p><p><a href='https://civicrm.org/'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>",
'body_html' => "<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700' rel='stylesheet' type='text/css'><p><a href=\"http://{action.forward}\">Forward this email</a><a href=\"{action.forward}\">Forward this email with no protocol</a></p<p>This is {contact.display_name}.</p><p><a href='https://civicrm.org/'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>",
'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("<p>This is $displayName.</p>", $previewResult['values']['body_html']);
$this->assertContains('<a href="' . $baseurl . 'index.php?q=civicrm/mailing/forward&amp;amp;reset=1&amp;jid=&amp;qid=&amp;h=">Forward this email with no protocol</a>', $previewResult['values']['body_html']);
$this->assertNotContains("http://http://", $previewResult['values']['body_html']);
}
public function testMailerPreviewRecipients() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment