From 6d659d487a5455ab3ae80ea62432068b42434335 Mon Sep 17 00:00:00 2001 From: Salvatore Martire Date: Tue, 16 Oct 2018 13:08:32 +0200 Subject: [PATCH] test: add groupBy mapping test --- tests/MappableTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/MappableTest.php b/tests/MappableTest.php index d1c6570..8be150f 100644 --- a/tests/MappableTest.php +++ b/tests/MappableTest.php @@ -36,6 +36,20 @@ public function mapped_select() $this->assertEquals($sql, $query->toSql()); } + /** + * @test + */ + public function mapped_groupBy() + { + $sql = 'select count(*) as aggregate from "users" '. + 'group by "profile"."first_name", "profile"."age", "ign"'; + + $model = $this->getModel(); + $model->getConnection()->shouldReceive('select')->once()->with($sql, [], m::any())->andReturn([]); + + $model->groupBy('first_name', 'age', 'nick')->count(); + } + /** * @test *