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 testReturnsNextInsertIndex(): void { $redis = $this->getClient(); $redis->arinsert('arr', 'a', 'b', 'c'); $this->assertSame(3, $redis->arnext('arr')); } /** * @group connected * @requiresRedisVersion >= 8.8.0 */ public function testReturnsZeroWhenKeyDoesNotExist(): void { $redis = $this->getClient(); $this->assertSame(0, $redis->arnext('nonexistent')); } /** * @group connected * @requiresRedisVersion >= 8.8.0 */ public function testReturnsNextInsertIndexResp3(): void { $redis = $this->getResp3Client(); $redis->arinsert('arr', 'a', 'b', 'c'); $this->assertSame(3, $redis->arnext('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->arnext('foo'); } }