From 2787905024fd660473ae842d5d7c08ecf96ae9c1 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Tue, 27 Apr 2010 21:54:37 +0200 Subject: [PATCH] Test suite: updated tests for ZUNION and ZINTER with the new options style. --- test/RedisCommandsTest.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/RedisCommandsTest.php b/test/RedisCommandsTest.php index fd98256f..bfd881b9 100644 --- a/test/RedisCommandsTest.php +++ b/test/RedisCommandsTest.php @@ -1214,21 +1214,24 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase { $this->assertEquals(0, $this->redis->zunion('zsetc', 2, 'zsetaNull', 'zsetbNull')); // with WEIGHTS - $this->assertEquals(4, $this->redis->zunion('zsetc', 2, 'zseta', 'zsetb', 'WEIGHTS', 2, 3)); + $options = array('weights' => array(2, 3)); + $this->assertEquals(4, $this->redis->zunion('zsetc', 2, 'zseta', 'zsetb', $options)); $this->assertEquals( array(array('a', 2), array('b', 7), array('d', 9), array('c', 12)), $this->redis->zrange('zsetc', 0, -1, 'withscores') ); // with AGGREGATE (min) - $this->assertEquals(4, $this->redis->zunion('zsetc', 2, 'zseta', 'zsetb', 'AGGREGATE', 'MIN')); + $options = array('aggregate' => 'min'); + $this->assertEquals(4, $this->redis->zunion('zsetc', 2, 'zseta', 'zsetb', $options)); $this->assertEquals( array(array('a', 1), array('b', 1), array('c', 2), array('d', 3)), $this->redis->zrange('zsetc', 0, -1, 'withscores') ); // with AGGREGATE (max) - $this->assertEquals(4, $this->redis->zunion('zsetc', 2, 'zseta', 'zsetb', 'AGGREGATE', 'MAX')); + $options = array('aggregate' => 'max'); + $this->assertEquals(4, $this->redis->zunion('zsetc', 2, 'zseta', 'zsetb', $options)); $this->assertEquals( array(array('a', 1), array('b', 2), array('c', 3), array('d', 3)), $this->redis->zrange('zsetc', 0, -1, 'withscores') @@ -1256,21 +1259,24 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase { $this->assertEquals(0, $this->redis->zinter('zsetc', 2, 'zsetaNull', 'zsetbNull')); // with WEIGHTS - $this->assertEquals(2, $this->redis->zinter('zsetc', 2, 'zseta', 'zsetb', 'WEIGHTS', 2, 3)); + $options = array('weights' => array(2, 3)); + $this->assertEquals(2, $this->redis->zinter('zsetc', 2, 'zseta', 'zsetb', $options)); $this->assertEquals( array(array('b', 7), array('c', 12)), $this->redis->zrange('zsetc', 0, -1, 'withscores') ); // with AGGREGATE (min) - $this->assertEquals(2, $this->redis->zinter('zsetc', 2, 'zseta', 'zsetb', 'AGGREGATE', 'MIN')); + $options = array('aggregate' => 'min'); + $this->assertEquals(2, $this->redis->zinter('zsetc', 2, 'zseta', 'zsetb', $options)); $this->assertEquals( array(array('b', 1), array('c', 2)), $this->redis->zrange('zsetc', 0, -1, 'withscores') ); // with AGGREGATE (max) - $this->assertEquals(2, $this->redis->zinter('zsetc', 2, 'zseta', 'zsetb', 'AGGREGATE', 'MAX')); + $options = array('aggregate' => 'max'); + $this->assertEquals(2, $this->redis->zinter('zsetc', 2, 'zseta', 'zsetb', $options)); $this->assertEquals( array(array('b', 2), array('c', 3)), $this->redis->zrange('zsetc', 0, -1, 'withscores')