diff --git a/tests/PHPUnit/Core/DataTable/ArrayTest.php b/tests/PHPUnit/Core/DataTable/ArrayTest.php
new file mode 100755
index 0000000000000000000000000000000000000000..9916ebf8c87fa91708b4f7e2d8024ea9d8e23253
--- /dev/null
+++ b/tests/PHPUnit/Core/DataTable/ArrayTest.php
@@ -0,0 +1,128 @@
+<?php
+class Test_Piwik_DataTable_Array extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+        Piwik::createConfigObject();
+        Piwik_Config::getInstance()->setTestEnvironment();
+        Piwik_DataTable_Manager::getInstance()->deleteAll();
+    }
+
+    private function createTestDataTable()
+    {
+        $result = new Piwik_DataTable();
+
+        $result->addRowsFromArray(array(
+            array(Piwik_DataTable_Row::COLUMNS => array('label'=> 'row1', 'col1' => 1)),
+            array(Piwik_DataTable_Row::COLUMNS => array('label'=> 'row2', 'col1' => 2))
+        ));
+
+        return $result;
+    }
+
+    private function createInstanceWithDataTables()
+    {
+        $dataTable = new Piwik_DataTable_Array();
+
+        $subDataTable1 = $this->createTestDataTable();
+        $dataTable->addTable($subDataTable1, 'subDataTable1');
+
+        $subDataTable2 = $this->createTestDataTable();
+        $dataTable->addTable($subDataTable2, 'subDataTable2');
+
+        return $dataTable;
+    }
+
+    private function createInstanceWithDataTableArrays()
+    {
+        $dataTable = new Piwik_DataTable_Array();
+
+        $subDataTableArray1                           = $this->createInstanceWithDataTables();
+        $subDataTableArray1->metadata['metadataKey1'] = 'metadataValue1';
+        $dataTable->addTable($subDataTableArray1, 'subArray1');
+
+        $subDataTableArray2 = $this->createInstanceWithDataTables();
+        $dataTable->addTable($subDataTableArray2, 'subArray2');
+
+        return $dataTable;
+    }
+
+    /**
+     * Tests that Piwik_DataTable_Array::mergeChildren works when the DataTable_Array contains DataTables.
+     * @group Core
+     * @group DataTable
+     * @group DataTable_Array
+     */
+    public function test_MergeChildrenDataTable()
+    {
+        $dataTable = $this->createInstanceWithDataTables();
+
+        $result = $dataTable->mergeChildren();
+
+        // check that the result is a DataTable w/ 4 rows
+        $this->assertInstanceOf('Piwik_DataTable', $result);
+        $this->assertEquals(4, $result->getRowsCount());
+
+        // check that the first two rows have 'subDataTable1' as the label
+        $this->mergeChildren_checkRow($result->getRowFromId(0), 'subDataTable1', 1);
+        $this->mergeChildren_checkRow($result->getRowFromId(1), 'subDataTable1', 2);
+
+        // check that the last two rows have 'subDataTable2' as the label
+        $this->mergeChildren_checkRow($result->getRowFromId(2), 'subDataTable2', 1);
+        $this->mergeChildren_checkRow($result->getRowFromId(3), 'subDataTable2', 2);
+    }
+
+    private function mergeChildren_checkRow($row, $expectedLabel, $expectedColumnValue)
+    {
+        $this->assertEquals($expectedLabel, $row->getColumn('label'));
+        $this->assertEquals($expectedColumnValue, $row->getColumn('col1'));
+    }
+
+    /**
+     * Tests that Piwik_DataTable_Array::mergeChildren works when the DataTable_Array contains DataTable_Arrays.
+     * @group Core
+     * @group DataTable
+     * @group DataTable_Array
+     */
+    public function testMergeChildrenDataTableArray()
+    {
+        $dataTable = $this->createInstanceWithDataTableArrays();
+
+        $result = $dataTable->mergeChildren();
+
+        // check that the result is a DataTable_Array w/ two DataTable children
+        $this->assertInstanceOf('Piwik_DataTable_Array', $result);
+        $this->assertEquals(2, $result->getRowsCount());
+
+        // check that the result has one metadata, 'metadataKey1' => 'metadataValue1'
+        $this->assertEquals(1, count($result->metadata));
+        $this->assertEquals('metadataValue1', $result->metadata['metadataKey1']);
+
+        // check that the first sub-DataTable is a DataTable with 4 rows
+        $subDataTable1 = $result->getTable('subDataTable1');
+        $this->assertTrue($subDataTable1 instanceof Piwik_DataTable);
+        $this->assertEquals(4, $subDataTable1->getRowsCount());
+
+        // check that the first two rows of the first sub-table have 'subArray1' as the label
+        $this->mergeChildren_checkRow($subDataTable1->getRowFromId(0), 'subArray1', 1);
+        $this->mergeChildren_checkRow($subDataTable1->getRowFromId(1), 'subArray1', 2);
+
+        // check that the last two rows of the first sub-table have 'subArray2' as the label
+        $this->mergeChildren_checkRow($subDataTable1->getRowFromId(2), 'subArray2', 1);
+        $this->mergeChildren_checkRow($subDataTable1->getRowFromId(3), 'subArray2', 2);
+
+        // check that the second sub-DataTable is a DataTable with 4 rows
+        $subDataTable2 = $result->getTable('subDataTable2');
+        $this->assertTrue($subDataTable2 instanceof Piwik_DataTable);
+        $this->assertEquals(4, $subDataTable2->getRowsCount());
+
+        // check that the first two rows of the second sub-table have 'subArray1' as the label
+        $this->mergeChildren_checkRow($subDataTable2->getRowFromId(0), 'subArray1', 1);
+        $this->mergeChildren_checkRow($subDataTable2->getRowFromId(1), 'subArray1', 2);
+
+        // check that the last two rows of the second sub-table have 'subArray2' as the label
+        $this->mergeChildren_checkRow($subDataTable2->getRowFromId(2), 'subArray2', 1);
+        $this->mergeChildren_checkRow($subDataTable2->getRowFromId(3), 'subArray2', 2);
+    }
+}
diff --git a/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php b/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php
index 30b5183e1928039a0727e013e32ebacc0a84c0ae..7249788b7bca0e0e6ecf7209d2fe1a51de75acb9 100644
--- a/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php
+++ b/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php
@@ -18,16 +18,16 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
         $table = new Piwik_DataTable;
         $idcol = Piwik_DataTable_Row::COLUMNS;
         $rows = array(
-            array( $idcol => array('label'=>'google',     'idRow' => 0)),
-            array( $idcol => array('label'=>'ask',         'idRow' => 1)),
-            array( $idcol => array('label'=>'piwik',     'idRow' => 2)),
-            array( $idcol => array('label'=>'yahoo',     'idRow' => 3)),
-            array( $idcol => array('label'=>'amazon',     'idRow' => 4)),
-            array( $idcol => array('label'=>'238949',     'idRow' => 5)),
-            array( $idcol => array('label'=>'test',     'idRow' => 6)),
-            array( $idcol => array('label'=>'amazing',     'idRow' => 7)),
-            array( $idcol => array('label'=>'great',     'idRow' => 8)),
-            Piwik_DataTable::ID_SUMMARY_ROW => array( $idcol => array('label'=>'summary row',    'idRow' => 9)),
+            array($idcol => array('label'=> 'google',  'idRow' => 0)),
+            array($idcol => array('label'=> 'ask',     'idRow' => 1)),
+            array($idcol => array('label'=> 'piwik',   'idRow' => 2)),
+            array($idcol => array('label'=> 'yahoo',   'idRow' => 3)),
+            array($idcol => array('label'=> 'amazon',  'idRow' => 4)),
+            array($idcol => array('label'=> '238949',  'idRow' => 5)),
+            array($idcol => array('label'=> 'test',    'idRow' => 6)),
+            array($idcol => array('label'=> 'amazing', 'idRow' => 7)),
+            array($idcol => array('label'=> 'great',   'idRow' => 8)),
+            Piwik_DataTable::ID_SUMMARY_ROW => array($idcol => array('label'=> 'summary row', 'idRow' => 9)),
         );
         $table->addRowsFromArray( $rows );
         return $table;
diff --git a/tests/PHPUnit/Core/Period/RangeTest.php b/tests/PHPUnit/Core/Period/RangeTest.php
index c0a4f886b3cb46121c88a78ed48c03327ac63a7b..4866cc47b03f88f3d11c4dd5f858baddbb2bca64 100644
--- a/tests/PHPUnit/Core/Period/RangeTest.php
+++ b/tests/PHPUnit/Core/Period/RangeTest.php
@@ -744,7 +744,7 @@ class Period_RangeTest extends PHPUnit_Framework_TestCase
             Piwik_Date::factory('2011-11-01'),
             Piwik_Date::factory('2011-11-30'),
             Piwik_Date::factory('2011-12-31'),
-            Piwik_Date::factory('2012-10-18')
+            Piwik_Date::factory('2021-10-18')
         );
         foreach($todays as $today)
         {
diff --git a/tests/PHPUnit/Core/UpdaterTest.php b/tests/PHPUnit/Core/UpdaterTest.php
index 44a58181b427615736b41d2c13122a062ca5f96d..9bd424306c512fb800de21e16df2a94e19136e64 100644
--- a/tests/PHPUnit/Core/UpdaterTest.php
+++ b/tests/PHPUnit/Core/UpdaterTest.php
@@ -44,7 +44,6 @@ class UpdaterTest extends DatabaseTestCase
             $path . '0.1.php' => '0.1'
         );
         $this->assertEquals($expectedInOrder, array_map("basename", $updateFiles));
-        
     }
 
     /**
diff --git a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
index 933a0a1ab46756b619ca193515982b7af1544259..614be9a0eac94578df1bf07ed76906f78f4a9cfb 100755
--- a/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
+++ b/tests/PHPUnit/Integration/OneVisitorTwoVisitsTest.php
@@ -88,11 +88,11 @@ class Test_Piwik_Integration_OneVisitorTwoVisits extends IntegrationTestCase
 
     protected static function trackVisits()
     {
-        $t = self::getTracker(self::$idSite, self::$dateTime, $defaultInit = true);
-
         $dateTime = self::$dateTime;
         $idSite   = self::$idSite;
 
+        $t = self::getTracker($idSite, $dateTime, $defaultInit = true);
+
         $t->disableCookieSupport();
 
         $t->setUrlReferrer('http://referer.com/page.htm?param=valuewith some spaces');
diff --git a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php
index e1e04475eea5bd2fac7abfcacad8da356e23cd7d..d78cd7e8a459c16ce379ee2de0979b8dc12b6da2 100755
--- a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php
+++ b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php
@@ -113,7 +113,7 @@ class Test_Piwik_Integration_TwoVisitors_TwoWebsites_DifferentDays extends Integ
         return 'TwoVisitors_twoWebsites_differentDays';
     }
 
-    public static function setUpWebsitesAndGoals()
+    protected static function setUpWebsitesAndGoals()
     {
         // tests run in UTC, the Tracker in UTC
         $ecommerce = self::$allowConversions ? 1 : 0;
diff --git a/tests/PHPUnit/Plugins/SEOTest.php b/tests/PHPUnit/Plugins/SEOTest.php
index 077398b5fdb93d11d4173e22c2c2548cfc4eec83..b13988b24a00c34ddcc0dd31fa4c44ef673d7d79 100644
--- a/tests/PHPUnit/Plugins/SEOTest.php
+++ b/tests/PHPUnit/Plugins/SEOTest.php
@@ -45,7 +45,7 @@ class SEOTest extends PHPUnit_Framework_TestCase
         $ranks = $renderer->render($dataTable);
         foreach ($ranks as $rank)
         {
-            $this->assertTrue(!empty($rank['rank']), $rank['id'] . ' expected non-zero rank, got [' . $rank['rank'] . ']');
+            $this->assertNotEmpty($rank['rank'], $rank['id'] . ' expected non-zero rank, got [' . $rank['rank'] . ']');
         }
     }
 }