File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -711,6 +711,42 @@ public function testWithinGroupOrderBy()
711711 $ this ->assertEquals ('16 ' , $ result [0 ]['id ' ]);
712712 }
713713
714+ public function testGroupNBy ()
715+ {
716+ $ query = SphinxQL::create (self ::$ conn )->select ()
717+ ->from ('rt ' )
718+ ->groupBy ('gid ' );
719+ $ this ->assertEquals (
720+ 'SELECT * FROM rt GROUP BY gid ' ,
721+ $ query ->compile ()->getCompiled ()
722+ );
723+
724+ $ query ->groupNBy (3 );
725+ $ this ->assertEquals (
726+ 'SELECT * FROM rt GROUP 3 BY gid ' ,
727+ $ query ->compile ()->getCompiled ()
728+ );
729+
730+ $ query ->resetGroupBy ();
731+ $ this ->assertEquals (
732+ 'SELECT * FROM rt ' ,
733+ $ query ->compile ()->getCompiled ()
734+ );
735+
736+ $ query ->groupBy ('gid ' );
737+ $ this ->assertEquals (
738+ 'SELECT * FROM rt GROUP BY gid ' ,
739+ $ query ->compile ()->getCompiled ()
740+ );
741+
742+ $ query ->resetGroupBy ()
743+ ->groupNBy (3 );
744+ $ this ->assertEquals (
745+ 'SELECT * FROM rt ' ,
746+ $ query ->compile ()->getCompiled ()
747+ );
748+ }
749+
714750 public function testOffset ()
715751 {
716752 $ this ->refill ();
You can’t perform that action at this time.
0 commit comments