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-17 14:30:52 +0400
committersgiehl <stefan@piwik.org>2014-01-17 14:30:52 +0400
commit2cea9216d468651e7662db2f0edc9d534ca0baa4 (patch)
tree6386a81f9e04e40e7e623f87d12c45837af343a2 /tests
parent54d80251fee99b61d2e5ff831b3cf977fe02c037 (diff)
added some more tests for uncovered functions
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Plugins/ReferrersTest.php72
1 files changed, 69 insertions, 3 deletions
diff --git a/tests/PHPUnit/Plugins/ReferrersTest.php b/tests/PHPUnit/Plugins/ReferrersTest.php
index 839e3d6c26..3fb7be7b28 100644
--- a/tests/PHPUnit/Plugins/ReferrersTest.php
+++ b/tests/PHPUnit/Plugins/ReferrersTest.php
@@ -164,10 +164,7 @@ class ReferrersTest extends PHPUnit_Framework_TestCase
}
/**
- * get search engine url from name and keyword
- *
* @group Plugins
- * @group Social
*
* @dataProvider getSocialNetworkFromDomainTestData
*/
@@ -176,4 +173,73 @@ class ReferrersTest extends PHPUnit_Framework_TestCase
include PIWIK_INCLUDE_PATH . '/core/DataFiles/Socials.php';
$this->assertEquals($expected, \Piwik\Plugins\Referrers\getSocialNetworkFromDomain($url));
}
+
+ public function getSocialsLogoFromUrlTestData()
+ {
+ return array(
+ array('http://www.facebook.com', 'facebook.com.png'),
+ array('www.facebook.com', 'facebook.com.png',),
+ array('http://lastfm.com.tr', 'last.fm.png'),
+ array('http://asdfasdf.org/test', 'xx.png'),
+ array('http://www.google.com', 'xx.png'),
+ );
+ }
+
+ /**
+ * @group Plugins
+ * @group Social
+ *
+ * @dataProvider getSocialsLogoFromUrlTestData
+ */
+ public function testGetSocialsLogoFromUrl($url, $expected)
+ {
+ include PIWIK_INCLUDE_PATH . '/core/DataFiles/Socials.php';
+ $this->assertContains($expected, \Piwik\Plugins\Referrers\getSocialsLogoFromUrl($url));
+ }
+
+
+ public function isSocialUrlTestData()
+ {
+ return array(
+ array('http://www.facebook.com', 'Facebook', true),
+ array('http://www.facebook.com', 'Twitter', false),
+ array('http://m.facebook.com', false, true),
+ array('http://lastfm.com.tr', 'Last.fm', true),
+ array('http://asdfasdf.org/test', false, false),
+ array('http://asdfasdf.com/test', 'Facebook', false),
+ );
+ }
+
+ /**
+ * @group Plugins
+ *
+ * @dataProvider isSocialUrlTestData
+ */
+ public function testIsSocialUrl($url, $assumedSocial, $expected)
+ {
+ include PIWIK_INCLUDE_PATH . '/core/DataFiles/Socials.php';
+ $this->assertEquals($expected, \Piwik\Plugins\Referrers\isSocialUrl($url, $assumedSocial));
+ }
+
+ public function removeUrlProtocolTestData()
+ {
+ return array(
+ array('http://www.facebook.com', 'www.facebook.com'),
+ array('https://bla.fr', 'bla.fr'),
+ array('ftp://bla.fr', 'bla.fr'),
+ array('udp://bla.fr', 'bla.fr'),
+ array('bla.fr', 'bla.fr'),
+ array('ASDasdASDDasd', 'ASDasdASDDasd'),
+ );
+ }
+
+ /**
+ * @group Plugins
+ *
+ * @dataProvider removeUrlProtocolTestData
+ */
+ public function testRemoveUrlProtocol($url, $expected)
+ {
+ $this->assertEquals($expected, \Piwik\Plugins\Referrers\removeUrlProtocol($url));
+ }
}