@@ -924,6 +924,56 @@ public function testSubselect()
924924 $ this ->assertEquals ('10 ' , $ result [0 ]['id ' ]);
925925 }
926926
927+ /**
928+ * @covers \Foolz\SphinxQL\SphinxQL::setSelect
929+ */
930+ public function testSetSelect ()
931+ {
932+ $ this ->refill ();
933+ $ q1 = SphinxQL::create (self ::$ conn )
934+ ->select (array ('id ' , 'gid ' ))
935+ ->from ('rt ' );
936+ $ q2 = clone $ q1 ;
937+ $ q2 ->setSelect (array ('id ' ));
938+ $ result = $ q1
939+ ->execute ()
940+ ->getStored ();
941+ $ this ->assertArrayHasKey ('id ' , $ result [0 ]);
942+ $ this ->assertArrayHasKey ('gid ' , $ result [0 ]);
943+ $ result = $ q2
944+ ->execute ()
945+ ->getStored ();
946+ $ this ->assertArrayHasKey ('id ' , $ result [0 ]);
947+ $ this ->assertArrayNotHasKey ('gid ' , $ result [0 ]);
948+
949+ $ q1 = SphinxQL::create (self ::$ conn )
950+ ->select ('id ' , 'gid ' )
951+ ->from ('rt ' );
952+ $ q2 = clone $ q1 ;
953+ $ q2 ->setSelect ('id ' );
954+ $ result = $ q1
955+ ->execute ()
956+ ->getStored ();
957+ $ this ->assertArrayHasKey ('id ' , $ result [0 ]);
958+ $ this ->assertArrayHasKey ('gid ' , $ result [0 ]);
959+ $ result = $ q2
960+ ->execute ()
961+ ->getStored ();
962+ $ this ->assertArrayHasKey ('id ' , $ result [0 ]);
963+ $ this ->assertArrayNotHasKey ('gid ' , $ result [0 ]);
964+ }
965+
966+ /**
967+ * @covers \Foolz\SphinxQL\SphinxQL::getSelect
968+ */
969+ public function testGetSelect ()
970+ {
971+ $ query = SphinxQL::create (self ::$ conn )
972+ ->select ('id ' , 'gid ' )
973+ ->from ('rt ' );
974+ $ this ->assertEquals (array ('id ' , 'gid ' ), $ query ->getSelect ());
975+ }
976+
927977 /**
928978 * @covers \Foolz\SphinxQL\SphinxQL::facet
929979 * @covers \Foolz\SphinxQL\SphinxQL::compileSelect
0 commit comments