Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PHPUnit/Integration/Tracker/TrackerCodeGeneratorTest.php')
-rw-r--r--tests/PHPUnit/Integration/Tracker/TrackerCodeGeneratorTest.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/Tracker/TrackerCodeGeneratorTest.php b/tests/PHPUnit/Integration/Tracker/TrackerCodeGeneratorTest.php
index 06f4bb5916..c8bce62d51 100644
--- a/tests/PHPUnit/Integration/Tracker/TrackerCodeGeneratorTest.php
+++ b/tests/PHPUnit/Integration/Tracker/TrackerCodeGeneratorTest.php
@@ -152,6 +152,41 @@ class TrackerCodeGeneratorTest extends IntegrationTestCase
$this->assertEquals($expected, $jsTag);
}
+ /**
+ * Tests the generated JS code with options before tracker url
+ */
+ public function testJavascriptTrackingCode_loadSync()
+ {
+ $generator = new TrackerCodeGenerator();
+
+ Piwik::addAction('Piwik.getJavascriptCode', function (&$codeImpl) {
+ $codeImpl['loadAsync'] = false;
+ });
+
+ $jsTag = $generator->generate($idSite = 1, $piwikUrl = 'http://localhost/piwik',
+ $mergeSubdomains = true, $groupPageTitlesByDomain = true, $mergeAliasUrls = true);
+
+ $expected = "<!-- Piwik -->
+<script type="text/javascript">
+ var _paq = _paq || [];
+ _paq.push([\"setDocumentTitle\", document.domain + \"/\" + document.title]);
+ _paq.push(['trackPageView']);
+ _paq.push(['enableLinkTracking']);
+ (function() {
+ var u="//localhost/piwik/";
+ _paq.push(['setTrackerUrl', u+'piwik.php']);
+ _paq.push(['setSiteId', '1']);
+
+ })();
+</script>
+<script type='text/javascript' src="//localhost/piwik/piwik.js">
+<noscript><p><img src="//localhost/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
+<!-- End Piwik Code -->
+";
+
+ $this->assertEquals($expected, $jsTag);
+ }
+
public function testStringsAreEscaped()
{
$generator = new TrackerCodeGenerator();