@@ -21,8 +21,8 @@ public function testSimple(): void {
2121 $ database = TestHelper::getDatabase ();
2222 if ($ database != NULL ) {
2323 $ query = new QueryImpl ($ database , 'dual ' );
24- $ query ->add (Restrictions::eq ('aName ' , 'aValue ' ));
25- $ query ->addOrder (Order::asc ('anotherName ' ));
24+ $ query ->where (Restrictions::eq ('aName ' , 'aValue ' ));
25+ $ query ->orderBy (Order::asc ('anotherName ' ));
2626 $ this ->assertEquals ('SELECT * FROM `dual` WHERE (`aName` = \'aValue \') ORDER BY `anotherName` ' , $ query ->getSelectSql ());
2727 }
2828 }
@@ -41,7 +41,7 @@ public function testSimpleProjection(): void {
4141 $ database = TestHelper::getDatabase ();
4242 if ($ database != NULL ) {
4343 $ query = new QueryImpl ($ database , 'dual ' );
44- $ query ->setProjection (Projections::rowCount ('cnt ' ));
44+ $ query ->select (Projections::rowCount ('cnt ' ));
4545 $ this ->assertEquals ('SELECT COUNT(*) AS `cnt` FROM `dual` ' , $ query ->getSelectSql ());
4646 }
4747 }
@@ -50,7 +50,7 @@ public function testSetColumns(): void {
5050 $ database = TestHelper::getDatabase ();
5151 if ($ database != NULL ) {
5252 $ query = new QueryImpl ($ database , 'dual ' );
53- $ query ->setColumns (Projections::property ('column1 ' ), Projections::property ('column2 ' ));
53+ $ query ->select (Projections::property ('column1 ' ), Projections::property ('column2 ' ));
5454 $ this ->assertEquals ('SELECT `column1`, `column2` FROM `dual` ' , $ query ->getSelectSql ());
5555 }
5656 }
@@ -59,7 +59,7 @@ public function testCombineColumns(): void {
5959 $ database = TestHelper::getDatabase ();
6060 if ($ database != NULL ) {
6161 $ query = new QueryImpl ($ database , 'dual ' );
62- $ query ->setColumns (Projections::properties ('column1 ' , 'column2 ' ));
62+ $ query ->select (Projections::properties ('column1 ' , 'column2 ' ));
6363 $ this ->assertEquals ('SELECT `column1`, `column2` FROM `dual` ' , $ query ->getSelectSql ());
6464 }
6565 }
@@ -68,7 +68,7 @@ public function testAddColumns(): void {
6868 $ database = TestHelper::getDatabase ();
6969 if ($ database != NULL ) {
7070 $ query = new QueryImpl ($ database , 'dual ' );
71- $ query ->addColumns (Projections::property ('column1 ' ))->addColumns (Projections::property ('column2 ' ));
71+ $ query ->select (Projections::property ('column1 ' ))->select (Projections::property ('column2 ' ));
7272 $ this ->assertEquals ('SELECT `column1`, `column2` FROM `dual` ' , $ query ->getSelectSql ());
7373 }
7474 }
@@ -77,7 +77,7 @@ public function testJoin(): void {
7777 $ database = TestHelper::getDatabase ();
7878 if ($ database != NULL ) {
7979 $ query = new QueryImpl ($ database , 'dual ' , NULL , 'a ' );
80- $ query ->createJoinedQuery ('otherTable ' , 'b ' , Restrictions::eqProperty (array ('a ' , 'details ' ), array ('b ' , 'uid ' )));
80+ $ query ->createJoin ('otherTable ' , 'b ' , Restrictions::eqProperty (array ('a ' , 'details ' ), array ('b ' , 'uid ' )));
8181 $ this ->assertEquals ('SELECT `a`.* FROM `dual` AS `a` INNER JOIN `otherTable` AS `b` ON `a`.`details` = `b`.`uid` ' , $ query ->getSelectSql ());
8282 }
8383 }
@@ -151,7 +151,7 @@ public function testDeleteWhereSql(): void {
151151 $ database = TestHelper::getDatabase ();
152152 if ($ database != NULL ) {
153153 $ query = new QueryImpl ($ database , 'dual ' );
154- $ query ->add (Restrictions::eq ('attr3 ' , 'value3 ' ));
154+ $ query ->where (Restrictions::eq ('attr3 ' , 'value3 ' ));
155155 $ this ->assertEquals ("DELETE FROM `dual` WHERE (`attr3` = 'value3') " , $ query ->getDeleteSql ());
156156 }
157157 }
@@ -161,10 +161,10 @@ public function testGroupBySql(): void {
161161 if ($ database != NULL ) {
162162 $ query = new QueryImpl ($ database , 'dual ' );
163163 $ query
164- ->addColumns (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
165- ->add (Restrictions::eq ('attr3 ' , 'value3 ' ))
164+ ->select (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
165+ ->where (Restrictions::eq ('attr3 ' , 'value3 ' ))
166166 ->groupBy (Projections::property ('attr1 ' ));
167- $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` GROUP BY `attr1` WHERE (`attr3` = 'value3') " , $ query ->getSelectSql ());
167+ $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` WHERE (`attr3` = 'value3') GROUP BY `attr1` " , $ query ->getSelectSql ());
168168 }
169169 }
170170
@@ -173,11 +173,11 @@ public function testHavingSql(): void {
173173 if ($ database != NULL ) {
174174 $ query = new QueryImpl ($ database , 'dual ' );
175175 $ query
176- ->addColumns (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
177- ->add (Restrictions::eq ('attr3 ' , 'value3 ' ))
176+ ->select (Projections::property ('attr1 ' ), Projections::rowCount ('cnt ' ))
177+ ->where (Restrictions::eq ('attr3 ' , 'value3 ' ))
178178 ->groupBy (Projections::property ('attr1 ' ))
179179 ->having (Restrictions::eq ('attr1 ' , 'value1 ' ));
180- $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` GROUP BY `attr1` HAVING (`attr1 ` = 'value1 ') WHERE (`attr3 ` = 'value3 ') " , $ query ->getSelectSql ());
180+ $ this ->assertEquals ("SELECT `attr1`, COUNT(*) AS `cnt` FROM `dual` WHERE (`attr3 ` = 'value3 ') GROUP BY `attr1` HAVING (`attr1 ` = 'value1 ') " , $ query ->getSelectSql ());
181181 }
182182 }
183183
0 commit comments