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:
authorsgiehl <stefan@piwik.org>2014-01-16 20:19:11 +0400
committersgiehl <stefan@piwik.org>2014-01-16 20:19:11 +0400
commit5d4a4cc65c0f1e33d15d7dd092448514a40ebc1c (patch)
tree8885be3b2a30c136393a1d15e932c0929e1e6c00 /tests
parentab3f264ff13a4887d577190ac8a5287b168d863e (diff)
added some simple tests for social network recognition
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Plugins/ReferrersTest.php36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/PHPUnit/Plugins/ReferrersTest.php b/tests/PHPUnit/Plugins/ReferrersTest.php
index 9017e8cf0f..839e3d6c26 100644
--- a/tests/PHPUnit/Plugins/ReferrersTest.php
+++ b/tests/PHPUnit/Plugins/ReferrersTest.php
@@ -142,4 +142,38 @@ class ReferrersTest extends PHPUnit_Framework_TestCase
include PIWIK_PATH_TEST_TO_ROOT . '/core/DataFiles/SearchEngines.php';
$this->assertEquals($expected, \Piwik\Plugins\Referrers\getSearchEngineUrlFromUrlAndKeyword($url, $keyword));
}
-} \ No newline at end of file
+
+ /**
+ * Dataprovider for getSocialNetworkFromDomainTestData
+ */
+ public function getSocialNetworkFromDomainTestData()
+ {
+ return array(
+ array('http://www.facebook.com', 'Facebook'),
+ array('http://www.facebook.com/piwik', 'Facebook'),
+ array('http://m.facebook.com', 'Facebook'),
+ array('https://m.facebook.com', 'Facebook'),
+ array('m.facebook.com', 'Facebook'),
+ array('http://lastfm.com.tr', 'Last.fm'),
+ array('http://t.co/test', 'Twitter'),
+ array('http://xxt.co/test', \Piwik\Piwik::translate('General_Unknown')),
+ array('asdfasdfadsf.com', \Piwik\Piwik::translate('General_Unknown')),
+ array('http://xwayn.com', \Piwik\Piwik::translate('General_Unknown')),
+ array('http://live.com/test', \Piwik\Piwik::translate('General_Unknown')),
+ );
+ }
+
+ /**
+ * get search engine url from name and keyword
+ *
+ * @group Plugins
+ * @group Social
+ *
+ * @dataProvider getSocialNetworkFromDomainTestData
+ */
+ public function testGetSocialNetworkFromDomain($url, $expected)
+ {
+ include PIWIK_INCLUDE_PATH . '/core/DataFiles/Socials.php';
+ $this->assertEquals($expected, \Piwik\Plugins\Referrers\getSocialNetworkFromDomain($url));
+ }
+}