diff --git a/tests/system/Database/Live/ModelTest.php b/tests/system/Database/Live/ModelTest.php index 32cab9d5021f..da9a83d71ef4 100644 --- a/tests/system/Database/Live/ModelTest.php +++ b/tests/system/Database/Live/ModelTest.php @@ -268,17 +268,19 @@ public function testFirstAggregate($groupBy) if ($groupBy) { - $user = $model->select('SUM(id) as total') - ->where('id >', 2) - ->groupBy('id') - ->first(); + $model->groupBy('id'); + } + + $user = $model->select('SUM(id) as total') + ->where('id >', 2) + ->first(); + + if ($groupBy) + { $this->assertEquals(3, $user->total); } else { - $user = $model->select('SUM(id) as total') - ->where('id >', 2) - ->first(); $this->assertEquals(7, $user->total); } }