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
path: root/tests
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2016-03-16 05:10:11 +0300
committermattab <matthieu.aubry@gmail.com>2016-03-30 06:11:40 +0300
commit3ff659d4281637bb752800d32f18cdd0050590b2 (patch)
tree682f028eebadb05c3eee2ed20a0aeb90093fb817 /tests
parent25b2da923b2dbe999e4b716a37cfa4f804fa1770 (diff)
piwik.js: remove the feature of `setDomains` magically setting the cookie path.
Instead, we will better document how to correctly set the cookie configuration. https://github.com/piwik/piwik/issues/9932
Diffstat (limited to 'tests')
-rw-r--r--tests/javascript/index.php37
-rw-r--r--tests/javascript/piwiktest.js1
2 files changed, 5 insertions, 33 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php
index 2e0e48723d..fa8cfc4886 100644
--- a/tests/javascript/index.php
+++ b/tests/javascript/index.php
@@ -2243,8 +2243,8 @@ function PiwikTest() {
}
});
- test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), findConfigCookiePathToUse() and getLinkIfShouldBeProcessed()", function() {
- expect(117);
+ test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), and getLinkIfShouldBeProcessed()", function() {
+ expect(105);
var tracker = Piwik.getTracker();
var initialDomains = tracker.getDomains();
@@ -2253,12 +2253,10 @@ function PiwikTest() {
equal( typeof tracker.hook.test._isSiteHostName, 'function', "isSiteHostName" );
equal( typeof tracker.hook.test._isSiteHostPath, 'function', "isSiteHostPath" );
equal( typeof tracker.hook.test._getLinkIfShouldBeProcessed, 'function', "getLinkIfShouldBeProcessed" );
- equal( typeof tracker.hook.test._findConfigCookiePathToUse, 'function', "findConfigCookiePathToUse" );
var isSiteHostName = tracker.hook.test._isSiteHostName;
var isSiteHostPath = tracker.hook.test._isSiteHostPath;
var getLinkIfShouldBeProcessed = tracker.hook.test._getLinkIfShouldBeProcessed;
- var findConfigCookiePathToUse = tracker.hook.test._findConfigCookiePathToUse;
// tracker.setDomain()
@@ -2416,45 +2414,20 @@ function PiwikTest() {
"type": "link"
}, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/footer')), 'getLinkIfShouldBeProcessed http://www.piwik.org/footer and there is domain piwik.org/foo but it should be outlink as path is different')
-
- /**
- * findConfigCookiePathToUse ()
- */
-
- tracker.setDomains( ['.piwik.org', '.piwik.pro/foo/bar', '.piwik.pro/foo', '.piwik.com/test/foo', 'example.com/foo'] );
-
- equal(null, findConfigCookiePathToUse('.piwik.org/test', 'http://piwik.org/test/two'), 'findConfigCookiePathToUse no cookiePath because there is a domain alias given allowing them all');
- equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a match');
- equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically');
- equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo'), 'findConfigCookiePathToUse should find a less restrictive path automatically, urlPath===domainPath');
- equal('/test/bar/test', findConfigCookiePathToUse('.piwik.com/test/bar/test', 'http://piwik.com/test/bar/test/'), 'findConfigCookiePathToUse should use exactly given path if no less restrictive version is available');
- equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo/test', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically, configAlias === currentUrl');
- equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically');
- equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/test'), 'findConfigCookiePathToUse should not return a path when user is actually not on that path');
- equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro'), 'findConfigCookiePathToUse when there is no path set we cannot use a configPath');
-
/**
* Test sets a good cookie path automatically
*/
tracker.setCookiePath(null);
tracker.setDomains( ['.' + domainAlias + '/tests'] );
- equal('/tests', tracker.getConfigCookiePath()), 'should set a cookie path automatically';
+ equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically');
tracker.setCookiePath(null);
tracker.setDomains( ['.' + domainAlias + '/tests/javascript'] );
- equal('/tests/javascript', tracker.getConfigCookiePath()), 'should set a cookie path automatically, multiple directories';
+ equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically');
tracker.setCookiePath(null);
tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.' + domainAlias + '/tests'] );
- equal('/tests', tracker.getConfigCookiePath()), 'should find shortest path for possible cookie path';
-
- tracker.setCookiePath(null);
- tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.example.com/tests'] );
- equal('/tests/javascript', tracker.getConfigCookiePath()), 'should not find a shorter path when no other domain matches';
-
- tracker.setCookiePath(null);
- tracker.setDomains( ['.' + domainAlias + '/another/one', '.example.org/tests/javascript', '.example.com/tests'] );
- equal(null, tracker.getConfigCookiePath()), 'should not set a path when no domain and no path matches';
+ equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically');
tracker.setCookiePath(null);
});
diff --git a/tests/javascript/piwiktest.js b/tests/javascript/piwiktest.js
index ff5525c47d..8430f54055 100644
--- a/tests/javascript/piwiktest.js
+++ b/tests/javascript/piwiktest.js
@@ -27,7 +27,6 @@ Piwik.addPlugin('testPlugin', {
'_getCookieName : getCookieName,' +
'_setCookie : setCookie,' +
'_getLinkIfShouldBeProcessed : getLinkIfShouldBeProcessed,' +
- '_findConfigCookiePathToUse : findConfigCookiePathToUse,' +
'_encode : encodeWrapper,' +
'_decode : decodeWrapper,' +
'_urldecode : urldecode,' +