diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/PHPUnit/Integration/CsvExportTest.php | 8 | ||||
-rwxr-xr-x | tests/PHPUnit/IntegrationTestCase.php | 9 |
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 |