getCommand(); $command->setArguments($arguments); $this->assertSame($expected, $command->getArguments()); } /** * @group disconnected */ public function testParseResponse(): void { $this->assertSame(5, $this->getCommand()->parseResponse(5)); } /** * @group disconnected */ public function testPrefixKeys(): void { /** @var PrefixableCommand $command */ $command = $this->getCommand(); $actualArguments = ['arg1']; $prefix = 'prefix:'; $expectedArguments = ['prefix:arg1']; $command->setArguments($actualArguments); $command->prefixKeys($prefix); $this->assertSame($expectedArguments, $command->getArguments()); } /** * @group connected * @requiresRedisVersion >= 8.8.0 */ public function testReturnsLengthOfArray(): void { $redis = $this->getClient(); $redis->arset('arr', 0, 'a', 'b', 'c'); $this->assertSame(3, $redis->arlen('arr')); } /** * @group connected * @requiresRedisVersion >= 8.8.0 */ public function testReturnsZeroOnNonExistingKey(): void { $redis = $this->getClient(); $this->assertSame(0, $redis->arlen('nonexistent')); } /** * @group connected * @requiresRedisVersion >= 8.8.0 */ public function testReturnsLengthResp3(): void { $redis = $this->getResp3Client(); $redis->arset('arr', 0, 'a', 'b', 'c'); $this->assertSame(3, $redis->arlen('arr')); } /** * @group connected * @requiresRedisVersion >= 8.8.0 */ public function testThrowsExceptionOnWrongType(): void { $this->expectException('Predis\Response\ServerException'); $this->expectExceptionMessage('Operation against a key holding the wrong kind of value'); $redis = $this->getClient(); $redis->set('foo', 'bar'); $redis->arlen('foo'); } }