@@ -27,6 +27,10 @@ public function setUp() {
27
27
$ this ->version = (isset ($ info ['redis_version ' ])?$ info ['redis_version ' ]:'0.0.0 ' );
28
28
}
29
29
30
+ protected function minVersionCheck ($ version ) {
31
+ return version_compare ($ this ->version , $ version , "ge " );
32
+ }
33
+
30
34
protected function newInstance () {
31
35
$ r = new Redis ();
32
36
@@ -4782,6 +4786,10 @@ protected function addCities($key) {
4782
4786
4783
4787
/* GEOADD */
4784
4788
public function testGeoAdd () {
4789
+ if (!$ this ->minVersionCheck ("3.2 " )) {
4790
+ return $ this ->markTestSkipped ();
4791
+ }
4792
+
4785
4793
$ this ->redis ->del ('geokey ' );
4786
4794
4787
4795
/* Add them one at a time */
@@ -4801,6 +4809,10 @@ public function testGeoAdd() {
4801
4809
4802
4810
/* GEORADIUS */
4803
4811
public function genericGeoRadiusTest ($ cmd ) {
4812
+ if (!$ this ->minVersionCheck ("3.2.0 " )) {
4813
+ return $ this ->markTestSkipped ();
4814
+ }
4815
+
4804
4816
/* Chico */
4805
4817
$ city = 'Chico ' ;
4806
4818
$ lng = -121.837478 ;
@@ -4868,26 +4880,46 @@ public function genericGeoRadiusTest($cmd) {
4868
4880
}
4869
4881
4870
4882
public function testGeoRadius () {
4883
+ if (!$ this ->minVersionCheck ("3.2.0 " )) {
4884
+ return $ this ->markTestSkipped ();
4885
+ }
4886
+
4871
4887
$ this ->genericGeoRadiusTest ('georadius ' );
4872
4888
}
4873
4889
4874
4890
public function testGeoRadiusByMember () {
4891
+ if (!$ this ->minVersionCheck ("3.2.0 " )) {
4892
+ return $ this ->markTestSkipped ();
4893
+ }
4894
+
4875
4895
$ this ->genericGeoRadiusTest ('georadiusbymember ' );
4876
4896
}
4877
4897
4878
4898
public function testGeoPos () {
4899
+ if (!$ this ->minVersionCheck ("3.2.0 " )) {
4900
+ return $ this ->markTestSkipped ();
4901
+ }
4902
+
4879
4903
$ this ->addCities ('gk ' );
4880
4904
$ this ->assertEquals ($ this ->redis ->geopos ('gk ' , 'Chico ' , 'Sacramento ' ), $ this ->rawCommandArray ('gk ' , Array ('geopos ' , 'gk ' , 'Chico ' , 'Sacramento ' )));
4881
4905
$ this ->assertEquals ($ this ->redis ->geopos ('gk ' , 'Cupertino ' ), $ this ->rawCommandArray ('gk ' , Array ('geopos ' , 'gk ' , 'Cupertino ' )));
4882
4906
}
4883
4907
4884
4908
public function testGeoHash () {
4909
+ if (!$ this ->minVersionCheck ("3.2.0 " )) {
4910
+ return $ this ->markTestSkipped ();
4911
+ }
4912
+
4885
4913
$ this ->addCities ('gk ' );
4886
4914
$ this ->assertEquals ($ this ->redis ->geohash ('gk ' , 'Chico ' , 'Sacramento ' ), $ this ->rawCommandArray ('gk ' , Array ('geohash ' , 'gk ' , 'Chico ' , 'Sacramento ' )));
4887
4915
$ this ->assertEquals ($ this ->redis ->geohash ('gk ' , 'Chico ' ), $ this ->rawCommandArray ('gk ' , Array ('geohash ' , 'gk ' , 'Chico ' )));
4888
4916
}
4889
4917
4890
4918
public function testGeoDist () {
4919
+ if (!$ this ->minVersionCheck ("3.2.0 " )) {
4920
+ return $ this ->markTestSkipped ();
4921
+ }
4922
+
4891
4923
$ this ->addCities ('gk ' );
4892
4924
4893
4925
$ r1 = $ this ->redis ->geodist ('gk ' , 'Chico ' , 'Cupertino ' );
0 commit comments