@@ -1971,6 +1971,20 @@ public function testZX() {
1971
1971
$ this ->redis ->delete ('key2 ' );
1972
1972
$ this ->redis ->delete ('key3 ' );
1973
1973
1974
+ //test zUnion with weights and aggegration function
1975
+ $ this ->redis ->zadd ('key1 ' , 1 , 'duplicate ' );
1976
+ $ this ->redis ->zadd ('key2 ' , 2 , 'duplicate ' );
1977
+ $ this ->redis ->zUnion ('keyU ' , array ('key1 ' ,'key2 ' ), array (1 ,1 ), 'MIN ' );
1978
+ $ this ->assertTrue ($ this ->redis ->zScore ('keyU ' , 'duplicate ' )===1.0 );
1979
+ $ this ->redis ->delete ('keyU ' );
1980
+
1981
+ //now test zUnion *without* weights but with aggregrate function
1982
+ $ this ->redis ->zUnion ('keyU ' , array ('key1 ' ,'key2 ' ), null , 'MIN ' );
1983
+ $ this ->assertTrue ($ this ->redis ->zScore ('keyU ' , 'duplicate ' )===1.0 );
1984
+ $ this ->redis ->delete ('keyU ' , 'key1 ' , 'key2 ' );
1985
+
1986
+
1987
+
1974
1988
// test integer and float weights (GitHub issue #109).
1975
1989
$ this ->redis ->del ('key1 ' , 'key2 ' , 'key3 ' );
1976
1990
@@ -2087,6 +2101,10 @@ public function testZX() {
2087
2101
$ this ->assertTrue ( 2 === $ this ->redis ->zInter ('keyI ' , array ('key1 ' , 'key2 ' , 'key3 ' ), array (1 , 5 , 1 ), 'max ' ));
2088
2102
$ this ->assertTrue (array ('val3 ' , 'val1 ' ) === $ this ->redis ->zRange ('keyI ' , 0 , -1 ));
2089
2103
2104
+ $ this ->redis ->delete ('keyI ' );
2105
+ $ this ->assertTrue (2 === $ this ->redis ->zInter ('keyI ' , array ('key1 ' , 'key2 ' , 'key3 ' ), null , 'max ' ));
2106
+ $ this ->assertTrue ($ this ->redis ->zScore ('keyI ' , 'val1 ' ) === floatval (7 ));
2107
+
2090
2108
// zrank, zrevrank
2091
2109
$ this ->redis ->delete ('z ' );
2092
2110
$ this ->redis ->zadd ('z ' , 1 , 'one ' );
0 commit comments