diff --git a/.travis.yml b/.travis.yml index c424d22bc12e..b720d5b10270 100755 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ services: before_install: - phpenv config-rm xdebug.ini || true - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - printf "\n" | pecl install -f redis-4.3.0 + - printf "\n" | pecl install -f redis - travis_retry composer self-update - mysql -e 'CREATE DATABASE forge;' diff --git a/src/Illuminate/Redis/Connections/PhpRedisConnection.php b/src/Illuminate/Redis/Connections/PhpRedisConnection.php index c52496554949..23b0cbe16fe3 100644 --- a/src/Illuminate/Redis/Connections/PhpRedisConnection.php +++ b/src/Illuminate/Redis/Connections/PhpRedisConnection.php @@ -268,7 +268,7 @@ public function zrevrangebyscore($key, $min, $max, $options = []) */ public function zinterstore($output, $keys, $options = []) { - return $this->command('zInter', [$output, $keys, + return $this->command('zinterstore', [$output, $keys, $options['weights'] ?? null, $options['aggregate'] ?? 'sum', ]); @@ -284,7 +284,7 @@ public function zinterstore($output, $keys, $options = []) */ public function zunionstore($output, $keys, $options = []) { - return $this->command('zUnion', [$output, $keys, + return $this->command('zunionstore', [$output, $keys, $options['weights'] ?? null, $options['aggregate'] ?? 'sum', ]); diff --git a/tests/Redis/RedisConnectionTest.php b/tests/Redis/RedisConnectionTest.php index 89d5064c118a..ea5788a13fdd 100644 --- a/tests/Redis/RedisConnectionTest.php +++ b/tests/Redis/RedisConnectionTest.php @@ -291,12 +291,16 @@ public function test_it_calculates_union_of_sorted_sets_and_stores() public function test_it_returns_range_in_sorted_set() { - foreach ($this->connections() as $redis) { + foreach ($this->connections() as $connector => $redis) { $redis->zadd('set', ['jeffrey' => 1, 'matt' => 5, 'taylor' => 10]); $this->assertEquals(['jeffrey', 'matt'], $redis->zrange('set', 0, 1)); $this->assertEquals(['jeffrey', 'matt', 'taylor'], $redis->zrange('set', 0, -1)); - $this->assertEquals(['jeffrey' => 1, 'matt' => 5], $redis->zrange('set', 0, 1, 'withscores')); + if ($connector === 'predis') { + $this->assertEquals(['jeffrey' => 1, 'matt' => 5], $redis->zrange('set', 0, 1, 'withscores')); + } else { + $this->assertEquals(['jeffrey' => 1, 'matt' => 5], $redis->zrange('set', 0, 1, true)); + } $redis->flushall(); } @@ -304,12 +308,16 @@ public function test_it_returns_range_in_sorted_set() public function test_it_returns_rev_range_in_sorted_set() { - foreach ($this->connections() as $redis) { + foreach ($this->connections() as $connector => $redis) { $redis->zadd('set', ['jeffrey' => 1, 'matt' => 5, 'taylor' => 10]); $this->assertEquals(['taylor', 'matt'], $redis->ZREVRANGE('set', 0, 1)); $this->assertEquals(['taylor', 'matt', 'jeffrey'], $redis->ZREVRANGE('set', 0, -1)); - $this->assertEquals(['matt' => 5, 'taylor' => 10], $redis->ZREVRANGE('set', 0, 1, 'withscores')); + if ($connector === 'predis') { + $this->assertEquals(['matt' => 5, 'taylor' => 10], $redis->ZREVRANGE('set', 0, 1, 'withscores')); + } else { + $this->assertEquals(['matt' => 5, 'taylor' => 10], $redis->ZREVRANGE('set', 0, 1, true)); + } $redis->flushall(); } @@ -550,8 +558,8 @@ public function test_it_persists_connection() public function connections() { $connections = [ - $this->redis['predis']->connection(), - $this->redis['phpredis']->connection(), + 'predis' => $this->redis['predis']->connection(), + 'phpredis' => $this->redis['phpredis']->connection(), ]; if (extension_loaded('redis')) {