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:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-09 23:01:27 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-09 23:01:27 +0400
commit1510afcf0467d7736bbbd197a15722c8a7b65b27 (patch)
treeba1375477da4b06967af5f781f2c4e5ef8ea4fce /tests
parent7a6a6f8a0528c098486d459c9b588d0ef91a7850 (diff)
Fixes #4063, allow csv renderer to handle arbitrarily nested data structures at least a little bit gracefully.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/PHPUnit/Integration/CsvExportTest.php8
-rwxr-xr-xtests/PHPUnit/IntegrationTestCase.php9
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/PHPUnit/Integration/CsvExportTest.php b/tests/PHPUnit/Integration/CsvExportTest.php
index 7e84ababdb..a5a9dfd475 100755
--- a/tests/PHPUnit/Integration/CsvExportTest.php
+++ b/tests/PHPUnit/Integration/CsvExportTest.php
@@ -44,6 +44,14 @@ class Test_Piwik_Integration_CsvExport extends IntegrationTestCase
'otherRequestParameters' => $deExtraParam,
'language' => 'de',
'testSuffix' => '_xp1_inner1_trans-de')),
+
+ // TODO: we cannot currently test the csv output of Live.getLastVisitsDetails. The API method includes
+ // random output. Normally we remove this when it's in XML output, but it's harder to do that w/
+ // CSV output. For now, we use compareOutput => false to just check that no errors result.
+ array('Live.getLastVisitsDetails', array('idSite' => $idSite,
+ 'date' => $dateTime,
+ 'format' => 'csv',
+ 'compareOutput' => false))
);
}
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index 19b4a92ca6..1925561934 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -710,7 +710,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
}
}
- protected function _testApiUrl($testName, $apiId, $requestUrl)
+ protected function _testApiUrl($testName, $apiId, $requestUrl, $compareOutput = true)
{
$isTestLogImportReverseChronological = strpos($testName, 'ImportedInRandomOrderTest') === false;
$isLiveMustDeleteDates = (strpos($requestUrl, 'Live.getLastVisits') !== false
@@ -743,6 +743,10 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
file_put_contents($processedFilePath, $response);
+ if (!$compareOutput) {
+ return;
+ }
+
$expected = $this->loadExpectedFile($expectedFilePath);
if (empty($expected)) {
print("The expected file is not found at '$expectedFilePath'. The Processed response was:");
@@ -1014,7 +1018,8 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
isset($params['fileExtension']) ? $params['fileExtension'] : false);
foreach ($requestUrls as $apiId => $requestUrl) {
- $this->_testApiUrl($testName . $testSuffix, $apiId, $requestUrl);
+ $this->_testApiUrl($testName . $testSuffix, $apiId, $requestUrl,
+ isset($params['compareOutput']) ? $params['compareOutput'] : true);
}
// change the language back to en