File tree Expand file tree Collapse file tree
tests/system/Database/Live Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,39 +251,40 @@ public function testFirst()
251251
252252 //--------------------------------------------------------------------
253253
254- public function testFirstWithoutGroupBy ()
254+ public function provideGroupBy ()
255255 {
256- $ model = new UserModel ();
257-
258- $ user = $ model ->select ('SUM(id) as total ' )
259- ->where ('id > ' , 2 )
260- ->first ();
261- $ this ->assertEquals (7 , $ user ->total );
256+ return [
257+ [true ],
258+ [false ],
259+ ];
262260 }
263261
264- //--------------------------------------------------------------------
265-
266- public function testFirstWithGroupBy ()
262+ /**
263+ * @dataProvider provideGroupBy
264+ */
265+ public function testFirstAggregate ($ groupBy )
267266 {
268267 $ model = new UserModel ();
269268
270- $ user = $ model ->select ('SUM(id) as total ' )
269+ if ($ groupBy )
270+ {
271+ $ user = $ model ->select ('SUM(id) as total ' )
271272 ->where ('id > ' , 2 )
272273 ->groupBy ('id ' )
273274 ->first ();
274- $ this ->assertEquals (3 , $ user ->total );
275+ $ this ->assertEquals (3 , $ user ->total );
276+ }
277+ else
278+ {
279+ $ user = $ model ->select ('SUM(id) as total ' )
280+ ->where ('id > ' , 2 )
281+ ->first ();
282+ $ this ->assertEquals (7 , $ user ->total );
283+ }
275284 }
276285
277286 //--------------------------------------------------------------------
278287
279- public function provideGroupBy ()
280- {
281- return [
282- [true ],
283- [false ],
284- ];
285- }
286-
287288 /**
288289 * @dataProvider provideGroupBy
289290 */
You can’t perform that action at this time.
0 commit comments