@@ -383,8 +383,14 @@ public function testIncr()
383
383
384
384
$ this ->redis ->incr ('key ' );
385
385
$ this ->assertTrue ("abc " === $ this ->redis ->get ('key ' ));
386
+ }
386
387
387
- // incrbyfloat
388
+ public function testIncrByFloat ()
389
+ {
390
+ // incrbyfloat is new in 2.6.0
391
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
392
+ return ;
393
+ }
388
394
389
395
$ this ->redis ->delete ('key ' );
390
396
@@ -1620,8 +1626,15 @@ public function testinfo() {
1620
1626
foreach ($ keys as $ k ) {
1621
1627
$ this ->assertTrue (in_array ($ k , array_keys ($ info )));
1622
1628
}
1629
+ }
1630
+
1631
+ public function testInfoCommandStats () {
1632
+
1633
+ // INFO COMMANDSTATS is new in 2.6.0
1634
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
1635
+ return ;
1636
+ }
1623
1637
1624
- // INFO COMMANDSTATS
1625
1638
$ info = $ this ->redis ->info ("COMMANDSTATS " );
1626
1639
1627
1640
$ this ->assertTrue (is_array ($ info ));
@@ -2024,6 +2037,7 @@ public function testHashes() {
2024
2037
$ this ->redis ->hSet ('h ' , 'y ' , 'not-a-number ' );
2025
2038
$ this ->assertTrue (FALSE === $ this ->redis ->hIncrBy ('h ' , 'y ' , 1 ));
2026
2039
2040
+ if (version_compare ($ this ->version , "2.5.0 " , "ge " )) {
2027
2041
// hIncrByFloat
2028
2042
$ this ->redis ->delete ('h ' );
2029
2043
$ this ->assertTrue (1.5 === $ this ->redis ->hIncrByFloat ('h ' ,'x ' , 1.5 ));
@@ -2032,6 +2046,7 @@ public function testHashes() {
2032
2046
2033
2047
$ this ->redis ->hset ('h ' ,'y ' ,'not-a-number ' );
2034
2048
$ this ->assertTrue (FALSE === $ this ->redis ->hIncrByFloat ('h ' , 'y ' , 1.5 ));
2049
+ }
2035
2050
2036
2051
// hmset
2037
2052
$ this ->redis ->delete ('h ' );
@@ -2971,6 +2986,11 @@ private function checkSerializer($mode) {
2971
2986
}
2972
2987
2973
2988
public function testDumpRestore () {
2989
+
2990
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
2991
+ return ;
2992
+ }
2993
+
2974
2994
$ this ->redis ->del ('foo ' );
2975
2995
$ this ->redis ->del ('bar ' );
2976
2996
@@ -3031,6 +3051,11 @@ private function array_diff_recursive($aArray1, $aArray2) {
3031
3051
}
3032
3052
3033
3053
public function testScript () {
3054
+
3055
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
3056
+ return ;
3057
+ }
3058
+
3034
3059
// Flush any scripts we have
3035
3060
$ this ->assertTrue ($ this ->redis ->script ('flush ' ));
3036
3061
@@ -3058,6 +3083,11 @@ public function testScript() {
3058
3083
}
3059
3084
3060
3085
public function testEval () {
3086
+
3087
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
3088
+ return ;
3089
+ }
3090
+
3061
3091
// Basic single line response tests
3062
3092
$ this ->assertTrue (1 == $ this ->redis ->eval ('return 1 ' ));
3063
3093
$ this ->assertTrue (1.55 == $ this ->redis ->eval ("return '1.55' " ));
@@ -3171,6 +3201,11 @@ public function testEval() {
3171
3201
}
3172
3202
3173
3203
public function testEvalSHA () {
3204
+
3205
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
3206
+ return ;
3207
+ }
3208
+
3174
3209
// Flush any loaded scripts
3175
3210
$ this ->redis ->script ('flush ' );
3176
3211
@@ -3264,6 +3299,11 @@ public function testReconnectSelect() {
3264
3299
}
3265
3300
3266
3301
public function testTime () {
3302
+
3303
+ if (version_compare ($ this ->version , "2.5.0 " , "lt " )) {
3304
+ return ;
3305
+ }
3306
+
3267
3307
$ time_arr = $ this ->redis ->time ();
3268
3308
$ this ->assertTrue (is_array ($ time_arr ) && count ($ time_arr ) == 2 &&
3269
3309
strval (intval ($ time_arr [0 ])) === strval ($ time_arr [0 ]) &&
0 commit comments