From d04905cccf76303d3cbb91f8641a84ed43a79797 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 12 May 2020 16:06:41 -0700 Subject: [PATCH] BaseMailingSystemTest - Allow either old or new style URLs for "extern/url" --- .../CRM/Mailing/BaseMailingSystemTest.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php b/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php index c1a262b9ee..286d4c8da8 100644 --- a/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php +++ b/tests/phpunit/CRM/Mailing/BaseMailingSystemTest.php @@ -200,7 +200,7 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { $this->assertRegExp( ";" . // body_html - "

You can go to Google" . + "

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

\n" . // Default footer "Sample Footer for HTML formatted content" . @@ -219,7 +219,7 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { "\n" . "Links:\n" . "------\n" . - "\\[1\\] http.*civicrm/mailing/url\.php\?u=\d+&qid=\d+\n" . + "\\[1\\] http.*(extern/url.php|civicrm/mailing/url)(\?|&)u=\d+&qid=\d+\n" . "\\[2\\] http.*civicrm/mailing/optout.*\n" . "\n" . // Default footer @@ -243,32 +243,32 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { $cases = []; // Tracking disabled - $cases[] = [ + $cases[0] = [ '

Foo

', ';

Foo

;', ';\\[1\\] http://example\.net/;', ['url_tracking' => 0], ]; - $cases[] = [ + $cases[1] = [ '

Foo

', // FIXME: Legacy tracker adds extra quote after URL ';

Foo

;', ';\\[1\\] http://example\.net/\?id=\d+;', ['url_tracking' => 0], ]; - $cases[] = [ + $cases[2] = [ '

Foo

', ';

Foo

;', ';\\[1\\] http.*civicrm/mailing/optout.*;', ['url_tracking' => 0], ]; - $cases[] = [ + $cases[3] = [ '

Look at .

', ';

Look at \.

;', ';Look at \.;', ['url_tracking' => 0], ]; - $cases[] = [ + $cases[4] = [ // Plain-text URL's are tracked in plain-text emails... // but not in HTML emails. "

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

", @@ -278,13 +278,13 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { ]; // Tracking enabled - $cases[] = [ + $cases[5] = [ '

Foo

', - ';

Foo

;', - ';\\[1\\] .*civicrm/mailing/url\.php\?u=\d+.*;', + ';

Foo

;', + ';\\[1\\] .*(extern/url.php|civicrm/mailing/url)[\?&]u=\d+.*;', ['url_tracking' => 1], ]; - $cases[] = [ + $cases[6] = [ // FIXME: CiviMail URL tracking doesn't track tokenized links. '

Foo

', // FIXME: Legacy tracker adds extra quote after URL @@ -292,26 +292,26 @@ abstract class CRM_Mailing_BaseMailingSystemTest extends CiviUnitTestCase { ';\\[1\\] http://example\.net/\?id=\d+;', ['url_tracking' => 1], ]; - $cases[] = [ + $cases[7] = [ // It would be redundant/slow to track the action URLs? '

Foo

', ';

Foo

;', ';\\[1\\] http.*civicrm/mailing/optout.*;', ['url_tracking' => 1], ]; - $cases[] = [ + $cases[8] = [ // It would be excessive/slow to track every embedded image. '

Look at .

', ';

Look at \.

;', ';Look at \.;', ['url_tracking' => 1], ]; - $cases[] = [ + $cases[8] = [ // Plain-text URL's are tracked in plain-text emails... // but not in HTML emails. "

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

", ";

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

;", - ';Please go to: .*civicrm/mailing.php\?u=\d+&qid=\d+;', + ';Please go to: .*(extern/url.php|civicrm/mailing/url)[\?&]u=\d+&qid=\d+;', ['url_tracking' => 1], ]; -- 2.25.1