@@ -39,7 +39,13 @@ public function setUp(): void
3939
4040 public function test_it_not_throw_with_regular_parameters ()
4141 {
42- $ parameter = new TestParameterClass (["column_a " , "column_b " , "column_c " , "column_d " ], $ this ->builder , $ this ->modelConfig );
42+ $ parameter = new TestParameterClass ([
43+ "column_a " ,
44+ "column_b " ,
45+ "column_c " ,
46+ "column_d " ,
47+ ], $ this ->builder , $ this ->modelConfig );
48+
4349 $ this ->assertNull ($ parameter ->run ());
4450 $ this ->assertEquals ('select "column_a", "column_b", "column_c", "column_d" ' , $ parameter ->builder ->toSql ());
4551 }
@@ -50,7 +56,7 @@ public function test_it_apply_aggregation_functions()
5056 $ builder = $ this ->builder ->clone ();
5157 $ parameter = new TestParameterClass (["$ fn:column " ], $ builder , $ this ->modelConfig );
5258 $ this ->assertNull ($ parameter ->run ());
53- $ this ->assertEquals ("select $ fn(column) as {$ fn }_column " , $ builder ->toSql ());
59+ $ this ->assertEquals ("select $ fn( \" column \" ) as {$ fn }_column " , $ builder ->toSql ());
5460 }
5561
5662 }
@@ -59,15 +65,22 @@ public function test_it_apply_nested_aggregation_functions()
5965 {
6066 $ parameter = new TestParameterClass (["avg:day:column " ], $ this ->builder , $ this ->modelConfig );
6167 $ this ->assertNull ($ parameter ->run ());
62- $ this ->assertEquals (" select avg(day(column)) as avg_day_column " , $ this ->builder ->toSql ());
68+ $ this ->assertEquals (' select avg(day(" column" )) as avg_day_column ' , $ this ->builder ->toSql ());
6369 }
6470
6571 public function test_it_uses_pgsql_syntax ()
6672 {
6773 app ("config " )->set ("database.default " , "pgsql " );
6874 $ parameter = new TestParameterClass (["avg:day:column " ], $ this ->builder , $ this ->modelConfig );
6975 $ this ->assertNull ($ parameter ->run ());
70- $ this ->assertEquals ("select avg(EXTRACT(DAY FROM column)) as avg_day_column " , $ this ->builder ->toSql ());
76+ $ this ->assertEquals ('select avg(EXTRACT(DAY FROM "column")) as avg_day_column ' , $ this ->builder ->toSql ());
77+ }
78+
79+ public function test_it_parses_right_count_all_query ()
80+ {
81+ $ parameter = new TestParameterClass (["count:* " ], $ this ->builder , $ this ->modelConfig );
82+ $ this ->assertNull ($ parameter ->run ());
83+ $ this ->assertEquals ('select count(*) as count ' , $ this ->builder ->toSql ());
7184 }
7285
7386}
0 commit comments