From cc477d9248e188f39348a7bc8189e11098534e90 Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Mon, 11 Nov 2013 17:28:27 +1300
Subject: [PATCH] Fix failing test due to data purger being enabled

---
 tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php |  6 +++++-
 tests/PHPUnit/IntegrationTestCase.php                 | 10 ++++++----
 tests/PHPUnit/UI                                      |  2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
index 9b578c015b..87295326a9 100755
--- a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
+++ b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
@@ -46,7 +46,11 @@ class Test_Piwik_Integration_OneVisitorTwoVisits extends IntegrationTestCase
         $idSite = self::$fixture->idSite;
         $dateTime = self::$fixture->dateTime;
 
-        $enExtraParam = array('expanded' => 1, 'flat' => 1, 'include_aggregate_rows' => 0, 'translateColumnNames' => 1);
+        $enExtraParam = array('expanded' => 1,
+                              'flat' => 1,
+                              'include_aggregate_rows' => 0,
+                              'translateColumnNames' => 1
+        );
         $bulkUrls = array(
             "idSite=" . $idSite . "&date=2010-03-06&expanded=1&period=day&method=VisitsSummary.get",
             "idSite=" . $idSite . "&date=2010-03-06&expanded=1&period=day&method=VisitorInterest.getNumberOfVisitsPerVisitDuration"
diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php
index 6ccb1c5db5..154ad75b5e 100755
--- a/tests/PHPUnit/IntegrationTestCase.php
+++ b/tests/PHPUnit/IntegrationTestCase.php
@@ -545,7 +545,8 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
                                                          ));
 
                         // find first row w/ subtable
-                        foreach ($request->process() as $row) {
+                        $content = $request->process();
+                        foreach ($content as $row) {
                             if (isset($row['idsubdatatable'])) {
                                 $parametersToSet['idSubtable'] = $row['idsubdatatable'];
                                 break;
@@ -973,6 +974,10 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
      */
     protected function runApiTests($api, $params)
     {
+        // make sure that the reports we process here are not directly deleted in ArchiveProcessor/PluginsArchiver
+        // (because we process reports in the past, they would sometimes be invalid, and would have been deleted)
+        Rules::$purgeDisabledByTests = true;
+
         $testName = 'test_' . static::getOutputPrefix();
         $this->missingExpectedFiles = array();
         $this->comparisonFailures = array();
@@ -1012,9 +1017,6 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
 
         $compareAgainst = isset($params['compareAgainst']) ? ('test_' . $params['compareAgainst']) : false;
 
-        // make sure that the reports we process here are not directly deleted in ArchiveProcessor/PluginsArchiver
-        // (because we process reports in the past, they would sometimes be invalid, and would have been deleted)
-        Rules::$purgeDisabledByTests = true;
 
         foreach ($requestUrls as $apiId => $requestUrl) {
             $this->_testApiUrl($testName . $testSuffix, $apiId, $requestUrl, $compareAgainst);
diff --git a/tests/PHPUnit/UI b/tests/PHPUnit/UI
index 0de660f2d7..176806335c 160000
--- a/tests/PHPUnit/UI
+++ b/tests/PHPUnit/UI
@@ -1 +1 @@
-Subproject commit 0de660f2d75b9f2013a480e45106e1496f645e96
+Subproject commit 176806335cc19d12d933f10b8e915650eb7c6fb1
-- 
GitLab