Fix shortcode being URL encoded

[MAILPOET-2540]
This commit is contained in:
Amine Ben hammou
2019-11-20 10:39:24 +01:00
committed by Jack Kitterhing
parent 56c0eb8cba
commit 5ca9b6f520
2 changed files with 25 additions and 8 deletions

View File

@ -23,8 +23,8 @@ class GATrackingTest extends \MailPoetTest {
$this->ga_campaign = 'Spring email';
$this->link = add_query_arg(['foo' => 'bar', 'baz' => 'xyz'], 'http://www.mailpoet.com/');
$this->rendered_newsletter = [
'html' => '<p><a href="' . $this->link . '">Click here</a>. <a href="http://somehost.com/fff/?abc=123">Do not process this</a> [link:some_link_shortcode]</p>',
'text' => '[Click here](' . $this->link . '). [Do not process this](http://somehost.com/fff/?abc=123) [link:some_link_shortcode]',
'html' => '<p><a href="' . $this->link . '">Click here</a>. <a href="http://somehost.com/fff/?abc=123&email=[subscriber:email]">Do not process this</a> [link:some_link_shortcode]</p>',
'text' => '[Click here](' . $this->link . '). [Do not process this](http://somehost.com/fff/?abc=123&email=[subscriber:email]) [link:some_link_shortcode]',
];
}
@ -69,6 +69,16 @@ class GATrackingTest extends \MailPoetTest {
expect($result['html'])->contains('utm_campaign=' . urlencode($this->ga_campaign));
}
function testItKeepsShorcodes() {
$tracking = new GATracking();
$newsletter = Newsletter::createOrUpdate([
'ga_campaign' => $this->ga_campaign,
]);
$result = $tracking->applyGATracking($this->rendered_newsletter, $newsletter, $this->internal_host);
expect($result['text'])->contains('email=[subscriber:email]');
expect($result['html'])->contains('email=[subscriber:email]');
}
function _after() {
\ORM::raw_execute('TRUNCATE ' . Newsletter::$_table);
}