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:
authorThomas Steur <thomas.steur@googlemail.com>2014-10-05 15:05:47 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-10-05 15:05:47 +0400
commit5a1eab97f54b44f57356b4276b9c9df2a8eef51b (patch)
tree83864ece2806ccf6e6bb49abf3fd65de92c13ad8 /tests/PHPUnit/System/SiteSearchTest.php
parent19bcd2d262343eae9d553378e4c66ce7e033b4d8 (diff)
refs #5940 put tests in correct folders, better testsuite names, some tests still fail and I cannot figure out why
Diffstat (limited to 'tests/PHPUnit/System/SiteSearchTest.php')
-rwxr-xr-xtests/PHPUnit/System/SiteSearchTest.php95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/PHPUnit/System/SiteSearchTest.php b/tests/PHPUnit/System/SiteSearchTest.php
new file mode 100755
index 0000000000..bb5b5c3bb0
--- /dev/null
+++ b/tests/PHPUnit/System/SiteSearchTest.php
@@ -0,0 +1,95 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+namespace Piwik\Tests\System;
+
+use Piwik\Tests\SystemTestCase;
+use Piwik\Tests\Fixtures\ThreeSitesWithManyVisitsWithSiteSearch;
+
+/**
+ * Testing the various use cases w/ internal Site Search tracking
+ *
+ * @group SiteSearchTest
+ * @group Plugins
+ */
+class SiteSearchTest extends SystemTestCase
+{
+ public static $fixture = null; // initialized below class definition
+
+ /**
+ * @dataProvider getApiForTesting
+ */
+ public function testApi($api, $params)
+ {
+ $this->runApiTests($api, $params);
+ }
+
+ protected function getApiToCall()
+ {
+ return array(
+ 'Actions.get',
+ 'Actions.getPageUrls',
+ 'Actions.getPageTitles',
+ 'CustomVariables.getCustomVariables',
+ 'Actions.getSiteSearchKeywords',
+ 'Actions.getSiteSearchCategories',
+ 'Actions.getSiteSearchNoResultKeywords',
+ 'Actions.getPageTitlesFollowingSiteSearch',
+ 'Actions.getPageUrlsFollowingSiteSearch',
+ );
+ }
+
+ public function getApiForTesting()
+ {
+ $dateTime = self::$fixture->dateTime;
+ $idSite1 = self::$fixture->idSite1;
+
+ $apiToCall = $this->getApiToCall();
+
+ $periods = array('day', 'month');
+
+ $result = array(
+ // Request data for the last 6 periods and idSite=all
+ array($apiToCall, array('idSite' => 'all',
+ 'date' => $dateTime,
+ 'periods' => $periods,
+ 'setDateLastN' => true,
+ 'testSuffix' => '_AllSites')),
+
+ // We also test a single period/single site to check that this use case (Reports per idSite in the response) works
+ array($apiToCall, array(
+ 'idSite' => $idSite1,
+ 'date' => $dateTime,
+ 'periods' => $periods,
+ 'setDateLastN' => false,
+ 'testSuffix' => '_NotLastNPeriods')),
+ );
+
+ // testing metadata API for multiple periods
+ foreach ($apiToCall as $api) {
+ list($apiModule, $apiAction) = explode(".", $api);
+
+ $result[] = array(
+ 'API.getProcessedReport', array('idSite' => $idSite1,
+ 'date' => $dateTime,
+ 'periods' => $periods,
+ 'setDateLastN' => true,
+ 'apiModule' => $apiModule,
+ 'apiAction' => $apiAction,
+ 'testSuffix' => '_' . $api . '_firstSite_lastN')
+ );
+ }
+ return $result;
+ }
+
+ public static function getOutputPrefix()
+ {
+ return 'SiteSearch';
+ }
+}
+
+SiteSearchTest::$fixture = new ThreeSitesWithManyVisitsWithSiteSearch(); \ No newline at end of file