|
@@ 56-70 (lines=15) @@
|
| 53 |
|
$this->assertContains($base_url."/mtracking.gif?d=", $output); |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
public function test_script_is_not_injected_in_footer_by_default() |
| 57 |
|
{ |
| 58 |
|
$base_url = 'http://example.com'; |
| 59 |
|
update_option('wpmautic_options', array('base_url' => $base_url)); |
| 60 |
|
do_action('plugins_loaded'); |
| 61 |
|
|
| 62 |
|
$output = $this->renderRawPage(false, true); |
| 63 |
|
|
| 64 |
|
$this->assertNotContains(sprintf("(window,document,'script','{$base_url}/mtc.js','mt')"), $output); |
| 65 |
|
$this->assertNotContains("['MauticTrackingObject']", $output); |
| 66 |
|
$this->assertNotContains("mt('send', 'pageview')", $output); |
| 67 |
|
|
| 68 |
|
//Fallback activated and <noscript> is always injected in footer ! |
| 69 |
|
$this->assertContains(sprintf("%s/mtracking.gif?d=", $base_url), $output); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
public function test_script_is_injected_in_footer_when_requested() |
| 73 |
|
{ |
|
@@ 72-84 (lines=13) @@
|
| 69 |
|
$this->assertContains(sprintf("%s/mtracking.gif?d=", $base_url), $output); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
public function test_script_is_injected_in_footer_when_requested() |
| 73 |
|
{ |
| 74 |
|
$base_url = 'http://example.com'; |
| 75 |
|
update_option('wpmautic_options', array('base_url' => $base_url, 'script_location' => 'footer')); |
| 76 |
|
do_action('plugins_loaded'); |
| 77 |
|
|
| 78 |
|
$output = $this->renderRawPage(false, true); |
| 79 |
|
|
| 80 |
|
$this->assertContains(sprintf("(window,document,'script','{$base_url}/mtc.js','mt')"), $output); |
| 81 |
|
$this->assertContains("['MauticTrackingObject']", $output); |
| 82 |
|
$this->assertContains("mt('send', 'pageview')", $output); |
| 83 |
|
$this->assertContains(sprintf("%s/mtracking.gif?d=", $base_url), $output); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
public function test_tracking_image_is_not_injected_when_disabled() |
| 87 |
|
{ |