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/ApiGetReportMetadataTest.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/ApiGetReportMetadataTest.php')
-rwxr-xr-xtests/PHPUnit/System/ApiGetReportMetadataTest.php92
1 files changed, 92 insertions, 0 deletions
diff --git a/tests/PHPUnit/System/ApiGetReportMetadataTest.php b/tests/PHPUnit/System/ApiGetReportMetadataTest.php
new file mode 100755
index 0000000000..be86b7f3ab
--- /dev/null
+++ b/tests/PHPUnit/System/ApiGetReportMetadataTest.php
@@ -0,0 +1,92 @@
+<?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\API\Proxy;
+use Piwik\Tests\SystemTestCase;
+use Piwik\Tests\Fixtures\ThreeGoalsOnePageview;
+
+/**
+ * This tests the output of the API plugin API
+ * It will return metadata about all API reports from all plugins
+ * as well as the data itself, pre-processed and ready to be displayed
+ *
+ * @group Plugins
+ * @group ApiGetReportMetadataTest
+ */
+class ApiGetReportMetadataTest extends SystemTestCase
+{
+ public static $fixture = null; // initialized below class definition
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ // From Piwik 1.5, we hide Goals.getConversions and other get* methods via @ignore, but we
+ // ensure that they still work. This hack allows the API proxy to let us generate example
+ // URLs for the ignored functions
+ Proxy::getInstance()->setHideIgnoredFunctions(false);
+ }
+
+ public function tearDown()
+ {
+ parent::tearDown();
+
+ // reset that value after the test
+ Proxy::getInstance()->setHideIgnoredFunctions(true);
+ }
+
+ public static function getOutputPrefix()
+ {
+ return 'apiGetReportMetadata';
+ }
+
+ public function getApiForTesting()
+ {
+ $idSite = self::$fixture->idSite;
+ $dateTime = self::$fixture->dateTime;
+
+ return array(
+ array('API', array('idSite' => $idSite, 'date' => $dateTime)),
+
+ // test w/ hideMetricsDocs=true
+ array('API.getMetadata', array('idSite' => $idSite, 'date' => $dateTime,
+ 'apiModule' => 'Actions', 'apiAction' => 'get',
+ 'testSuffix' => '_hideMetricsDoc',
+ 'otherRequestParameters' => array('hideMetricsDoc' => 1))),
+ array('API.getProcessedReport', array('idSite' => $idSite, 'date' => $dateTime,
+ 'apiModule' => 'Actions', 'apiAction' => 'get',
+ 'testSuffix' => '_hideMetricsDoc',
+ 'otherRequestParameters' => array('hideMetricsDoc' => 1))),
+
+ // Test w/ showRawMetrics=true
+ array('API.getProcessedReport', array('idSite' => $idSite, 'date' => $dateTime,
+ 'apiModule' => 'UserCountry', 'apiAction' => 'getCountry',
+ 'testSuffix' => '_showRawMetrics',
+ 'otherRequestParameters' => array('showRawMetrics' => 1))),
+
+ // Test w/ showRawMetrics=true
+ array('Actions.getPageTitles', array('idSite' => $idSite, 'date' => $dateTime,
+ 'testSuffix' => '_pageTitleZeroString')),
+
+ // test php renderer w/ array data
+ array('API.getDefaultMetricTranslations', array('idSite' => $idSite, 'date' => $dateTime,
+ 'format' => 'php', 'testSuffix' => '_phpRenderer')),
+ );
+ }
+
+ /**
+ * @dataProvider getApiForTesting
+ */
+ public function testApi($api, $params)
+ {
+ $this->runApiTests($api, $params);
+ }
+}
+
+ApiGetReportMetadataTest::$fixture = new ThreeGoalsOnePageview(); \ No newline at end of file