From 360269e5c3d8e900c6f404b882bafd6c331a4e06 Mon Sep 17 00:00:00 2001 From: Michael McAndrew Date: Mon, 11 Dec 2017 10:44:22 +0000 Subject: [PATCH] Various changes / improvements to MailingSystemTest --- .../CRM/Mailing/BaseMailingSystemTest.php | 53 ++++++++----------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php b/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php index 37bf968c14..7ebc8f169e 100644 --- a/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php +++ b/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php @@ -129,7 +129,7 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { ";" . "Sample Header for TEXT formatted content.\n" . // Default header "BEWARE children need regular infusions of toys. Santa knows your .*\\. There is no http.*civicrm/mailing/optout.*\\.\n" . - "to unsubscribe: http.*civicrm/mailing/optout" . // Default footer + "Unsubscribe: http.*civicrm/mailing/optout" . // Default footer ";", $message->body->text ); @@ -158,29 +158,26 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { $this->assertEquals('html', $htmlPart->subType); $this->assertRegExp( ";" . - "Sample Header for HTML formatted content.\n" . // Default header + "

Sample Header for HTML formatted content\.

.*" . // Default header // FIXME: CiviMail puts double " after hyperlink! - "

You can go to Google or opt out.

\n" . // body_html - "Sample Footer for HTML formatted content" . // Default footer - ".*\n" . + "

You can go to Google or opt out.

.*" . // body_html + "

Sample Footer for HTML formatted content\.

.*" . // Default footer "text ); - $this->assertEquals('plain', $textPart->subType); $this->assertRegExp( ";" . - "Sample Header for TEXT formatted content.\n" . // Default header - "You can go to Google \\[1\\] or opt out \\[2\\]\\.\n" . // body_html, filtered - "\n" . - "Links:\n" . - "------\n" . - "\\[1\\] http://example.net/first\\?cs=[0-9a-f_]+\n" . - "\\[2\\] http.*civicrm/mailing/optout.*\n" . - "\n" . - "to unsubscribe: http.*civicrm/mailing/optout" . // Default footer - ";", + "Sample Header for HTML formatted content\\..*" . // Default header (converted from HTML as it was not supplied) + "You can go to Google \\[1\\] or opt out \\[2\\]\\..*" . // Text body (converted from HTML as it was not supplied) + "Sample Footer for HTML formatted content\..*" . // Footer footer (converted from HTML as it was not supplied) + "Unsubscribe \\[2\\]\\..*" . // Text body (converted from HTML as it was not supplied) + "Links:.*" . + "------.*" . + "\\[1\\] http://example.net/first\\?cs=[0-9a-f_]+.*" . + "\\[2\\] http.*civicrm/mailing/optout.*" . + ";s", $textPart->text ); } @@ -212,28 +209,23 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { "

You can go to Google" . " or opt out.

\n" . // Default footer - "Sample Footer for HTML formatted content" . + "

Sample Footer for HTML formatted content\.

" . ".*\n" . // Open-tracking code "text ); - $this->assertEquals('plain', $textPart->subType); $this->assertRegExp( ";" . - // body_html, filtered - "You can go to Google \\[1\\] or opt out \\[2\\]\\.\n" . - "\n" . + "You can go to Google \\[1\\] or opt out \\[2\\]\\..*" . + "Unsubscribe \\[2\\].*" . "Links:\n" . "------\n" . - "\\[1\\] .*extern/url\.php\?u=\d+&qid=\d+\n" . - "\\[2\\] http.*civicrm/mailing/optout.*\n" . - "\n" . - // Default footer - "to unsubscribe: http.*civicrm/mailing/optout" . - ";", + "\\[1\\] .*extern/url\.php\?u=\d+&qid=\d+.*" . + "\\[2\\] http.*civicrm/mailing/optout.*" . + ";s", $textPart->text ); } @@ -315,11 +307,10 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { array('url_tracking' => 1), ); $cases[] = array( - // Plain-text URL's are tracked in plain-text emails... - // but not in HTML emails. + // Plain-text URLs are not tracked. "

Please go to: http://example.net/

", ";

Please go to: http://example\.net/

;", - ';Please go to: .*extern/url.php\?u=\d+&qid=\d+;', + ';Please go to: http://example\.net/;', array('url_tracking' => 1), ); -- 2.25.1