public function compareAggregation($factTables, $aggrTables, $maxDiffInPercent = 0, $factFilter = '1=1', $aggrFilter = '1=1') { $aggrGroups = DWHInspector::groupBy($aggrTables, $aggrFilter); $factGroups = DWHInspector::groupBy($factTables, $factFilter); foreach ($factGroups as $id => $measure) { if (!array_key_exists($id, $aggrGroups)) { $this->assertEquals(0, $measure, "For the following group (larger than 0 in fact, doesn't exist in aggregation): " . $id . ". Fact = " . $measure); } else { if ($aggrGroups[$id] == 0) { $this->assertEquals(0, $measure, "For the following group:" . $id . ".Aggr = " . $aggrGroups[$id] . ". Fact = " . $measure); } else { $this->assertLessThanOrEqual($maxDiffInPercent, abs(100 - $measure / $aggrGroups[$id] * 100), "For the following group:" . $id . ".Aggr = " . $aggrGroups[$id] . ". Fact = " . $measure); } } } }