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/Unit/ReferrersTest.php')
-rw-r--r--plugins/Referrers/tests/Unit/ReferrersTest.php95
1 files changed, 1 insertions, 94 deletions
diff --git a/plugins/Referrers/tests/Unit/ReferrersTest.php b/plugins/Referrers/tests/Unit/ReferrersTest.php
index 15bbf72ec1..e5dea866e9 100644
--- a/plugins/Referrers/tests/Unit/ReferrersTest.php
+++ b/plugins/Referrers/tests/Unit/ReferrersTest.php
@@ -16,103 +16,10 @@ use Piwik\Plugins\Referrers\SearchEngine;
require_once PIWIK_INCLUDE_PATH . '/plugins/Referrers/Referrers.php';
/**
- * @group Referererer
+ * @group Plugin
*/
class ReferrersTest extends \PHPUnit_Framework_TestCase
{
-
- public static function setUpBeforeClass()
- {
- // inject definitions to avoid database usage
- $yml = file_get_contents(PIWIK_INCLUDE_PATH . SearchEngine::DEFINITION_FILE);
- SearchEngine::getInstance()->loadYmlData($yml);
-
- parent::setUpBeforeClass();
- }
-
- /**
- * Dataprovider serving all search engine data
- */
- public function getSearchEngines()
- {
- $searchEngines = array();
- foreach (SearchEngine::getInstance()->getSearchEngineDefinitions() as $url => $searchEngine) {
- $searchEngines[] = array($url, $searchEngine);
- }
- return $searchEngines;
- }
-
- /**
- * search engine has at least one keyword
- *
- * @group Plugins
- *
- * @dataProvider getSearchEngines
- */
- public function testMissingSearchEngineKeyword($url, $searchEngine)
- {
- // Get list of search engines and first appearing URL
- static $searchEngines = array();
-
- $name = parse_url('http://' . $url);
- if (!array_key_exists($searchEngine['name'], $searchEngines)) {
- $searchEngines[$searchEngine['name']] = $url;
-
- $this->assertTrue(!empty($searchEngine['params']), $name['host']);
- }
- }
-
- /**
- * search engine is defined in DataFiles/SearchEngines.php but there's no favicon
- *
- * @group Plugins
- *
- * @dataProvider getSearchEngines
- */
- public function testMissingSearchEngineIcons($url, $searchEngine)
- {
- // Get list of existing favicons
- $favicons = scandir(PIWIK_PATH_TEST_TO_ROOT . '/plugins/Referrers/images/searchEngines/');
-
- // Get list of search engines and first appearing URL
- static $searchEngines = array();
-
- $name = parse_url('http://' . $url);
- if (!array_key_exists($searchEngine['name'], $searchEngines)) {
- $searchEngines[$searchEngine['name']] = $url;
-
- $this->assertTrue(in_array($name['host'] . '.png', $favicons), $name['host']);
- }
- }
-
- /**
- * favicon exists but there's no corresponding search engine defined in DataFiles/SearchEngines.php
- *
- * @group Plugins
- */
- public function testObsoleteSearchEngineIcons()
- {
- // Get list of search engines and first appearing URL
- $searchEngines = array();
- foreach (SearchEngine::getInstance()->getSearchEngineDefinitions() as $url => $searchEngine) {
- $name = parse_url('http://' . $url);
- if (!array_key_exists($name['host'], $searchEngines)) {
- $searchEngines[$name['host']] = true;
- }
- }
-
- // Get list of existing favicons
- $favicons = scandir(PIWIK_PATH_TEST_TO_ROOT . '/plugins/Referrers/images/searchEngines/');
- foreach ($favicons as $name) {
- if ($name[0] == '.' || strpos($name, 'xx.') === 0) {
- continue;
- }
-
- $host = substr($name, 0, -4);
- $this->assertTrue(array_key_exists($host, $searchEngines), $host);
- }
- }
-
public function removeUrlProtocolTestData()
{
return array(