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 'plugins/Referrers/tests')
-rw-r--r--plugins/Referrers/tests/Integration/Columns/ReferrerKeywordTest.php2
-rw-r--r--plugins/Referrers/tests/Integration/Columns/ReferrerNameTest.php2
-rw-r--r--plugins/Referrers/tests/Integration/Columns/ReferrerTypeTest.php17
-rw-r--r--plugins/Referrers/tests/Unit/SearchEngineTest.php2
4 files changed, 19 insertions, 4 deletions
diff --git a/plugins/Referrers/tests/Integration/Columns/ReferrerKeywordTest.php b/plugins/Referrers/tests/Integration/Columns/ReferrerKeywordTest.php
index f5ff10e11c..1e7e4af8cb 100644
--- a/plugins/Referrers/tests/Integration/Columns/ReferrerKeywordTest.php
+++ b/plugins/Referrers/tests/Integration/Columns/ReferrerKeywordTest.php
@@ -38,7 +38,7 @@ class ReferrerKeywordTest extends IntegrationTestCase
$ecommerce = false;
Fixture::createWebsite($date, $ecommerce, $name = 'test1', $url = 'http://piwik.org/');
- Fixture::createWebsite($date, $ecommerce, $name = 'test3', $url = 'http://piwik.pro/');
+ Fixture::createWebsite($date, $ecommerce, $name = 'test3', $url = 'http://piwik.xyz/');
$this->keyword = new Keyword();
}
diff --git a/plugins/Referrers/tests/Integration/Columns/ReferrerNameTest.php b/plugins/Referrers/tests/Integration/Columns/ReferrerNameTest.php
index f118e14ba6..cd1610a178 100644
--- a/plugins/Referrers/tests/Integration/Columns/ReferrerNameTest.php
+++ b/plugins/Referrers/tests/Integration/Columns/ReferrerNameTest.php
@@ -44,7 +44,7 @@ class ReferrerNameTest extends IntegrationTestCase
Fixture::createWebsite($date, $ecommerce, $name = 'test1', $url = 'http://piwik.org/foo/bar');
Fixture::createWebsite($date, $ecommerce, $name = 'test2', $url = 'http://piwik.org/');
- Fixture::createWebsite($date, $ecommerce, $name = 'test3', $url = 'http://piwik.pro/');
+ Fixture::createWebsite($date, $ecommerce, $name = 'test3', $url = 'http://piwik.xyz/');
$this->referrerName = new ReferrerName();
}
diff --git a/plugins/Referrers/tests/Integration/Columns/ReferrerTypeTest.php b/plugins/Referrers/tests/Integration/Columns/ReferrerTypeTest.php
index 5925dbc5c0..63da107af5 100644
--- a/plugins/Referrers/tests/Integration/Columns/ReferrerTypeTest.php
+++ b/plugins/Referrers/tests/Integration/Columns/ReferrerTypeTest.php
@@ -32,6 +32,7 @@ class ReferrerTypeTest extends IntegrationTestCase
private $idSite1 = 1;
private $idSite2 = 2;
private $idSite3 = 3;
+ private $idSite4 = 4;
public function setUp()
{
@@ -44,7 +45,8 @@ class ReferrerTypeTest extends IntegrationTestCase
Fixture::createWebsite($date, $ecommerce, $name = 'test1', $url = 'http://piwik.org/foo/bar');
Fixture::createWebsite($date, $ecommerce, $name = 'test2', $url = 'http://piwik.org/');
- Fixture::createWebsite($date, $ecommerce, $name = 'test3', $url = 'http://piwik.pro/');
+ Fixture::createWebsite($date, $ecommerce, $name = 'test3', $url = 'http://piwik.xyz/');
+ Fixture::createWebsite($date, $ecommerce, $name = 'test4', $url = 'http://google.com/subdir/', 1, null, null, null, null, $excludeUnknownUrls = 1);
$this->referrerType = new ReferrerType();
}
@@ -112,6 +114,19 @@ class ReferrerTypeTest extends IntegrationTestCase
// testing case where domain of referrer is not known to any site but neither is the URL, url != urlref
array(Common::REFERRER_TYPE_WEBSITE, $this->idSite3, 'http://example.org', 'http://example.com/bar'),
+
+ ####### testing specific case:
+ ## - ignore unknown urls is activated for idSite4
+
+ // referrer comes from another subdir, but same host => external website
+ array(Common::REFERRER_TYPE_WEBSITE, $this->idSite4, 'http://google.com/subdir/site', 'http://google.com/base'),
+ // referrer comes from same subdir and host => direct entry
+ array(Common::REFERRER_TYPE_DIRECT_ENTRY, $this->idSite4, 'http://google.com/subdir/page', 'http://google.com/subdir/x'),
+ array(Common::REFERRER_TYPE_DIRECT_ENTRY, $this->idSite4, 'http://google.com/subdir/', 'http://google.com/subdir/?q=test'),
+ // referrer comes from another subdir, but same host, query matches search engine definition => search engine
+ array(Common::REFERRER_TYPE_SEARCH_ENGINE, $this->idSite4, 'http://google.com/subdir/index.html', 'http://google.com/search?q=test'),
+ // referrer comes from search engine not matching site
+ array(Common::REFERRER_TYPE_SEARCH_ENGINE, $this->idSite4, 'http://google.com/subdir/index.html', 'http://google.fr/search?q=test')
);
}
diff --git a/plugins/Referrers/tests/Unit/SearchEngineTest.php b/plugins/Referrers/tests/Unit/SearchEngineTest.php
index e9f0c926ea..1b5cab4dbc 100644
--- a/plugins/Referrers/tests/Unit/SearchEngineTest.php
+++ b/plugins/Referrers/tests/Unit/SearchEngineTest.php
@@ -121,7 +121,7 @@ class SearchEngineTest extends \PHPUnit_Framework_TestCase
public function testMissingSearchEngineKeyword($url, $searchEngine)
{
$name = parse_url('http://' . $url);
- $this->assertTrue(!empty($searchEngine['params']), $name['host']);
+ $this->assertTrue(!empty($searchEngine['params']) || !empty($searchEngine['hiddenkeyword']), $name['host']);
}
/**