getCommand(); $command->setArguments($actualArguments); $this->assertSameValues($expectedArguments, $command->getArguments()); } /** * @group disconnected */ public function testParseResponse(): void { $actualResponse = [ 'Compression', 100, 'Capacity', 610, 'Merged nodes', 0, 'Unmerged nodes', 5, 'Merged weight', 0, 'Unmerged weight', 5, 'Observations', 5, 'Total compressions', 0, 'Memory usage', 9768, ]; $expectedResponse = [ 'Compression' => 100, 'Capacity' => 610, 'Merged nodes' => 0, 'Unmerged nodes' => 5, 'Merged weight' => 0, 'Unmerged weight' => 5, 'Observations' => 5, 'Total compressions' => 0, 'Memory usage' => 9768, ]; $this->assertSame($expectedResponse, $this->getCommand()->parseResponse($actualResponse)); } /** * @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 * @group relay-resp3 * @return void * @requiresRedisBfVersion >= 2.4.0 */ public function testInfoReturnsInformationAboutGivenTDigestSketch(): void { $redis = $this->getClient(); $expectedResponse = [ 'Compression' => 100, 'Capacity' => 610, 'Merged nodes' => 0, 'Unmerged nodes' => 0, 'Merged weight' => 0, 'Unmerged weight' => 0, 'Observations' => 0, 'Total compressions' => 0, 'Memory usage' => 9768, ]; $redis->tdigestcreate('key'); $this->assertSame($expectedResponse, $redis->tdigestinfo('key')); } /** * @group connected * @group relay-resp3 * @return void * @requiresRedisBfVersion >= 2.6.0 */ public function testInfoReturnsInformationAboutGivenTDigestSketchResp3(): void { $redis = $this->getResp3Client(); $expectedResponse = [ 'Compression' => 100, 'Capacity' => 610, 'Merged nodes' => 0, 'Unmerged nodes' => 0, 'Merged weight' => 0, 'Unmerged weight' => 0, 'Observations' => 0, 'Total compressions' => 0, 'Memory usage' => 9768, ]; $redis->tdigestcreate('key'); $this->assertSame($expectedResponse, $redis->tdigestinfo('key')); } /** * @group connected * @group relay-resp3 * @return void * @requiresRedisBfVersion >= 2.4.0 */ public function testThrowsExceptionOnNonExistingTDigestSketch(): void { $redis = $this->getClient(); $this->expectException(ServerException::class); $this->expectExceptionMessage('ERR T-Digest: key does not exist'); $redis->tdigestinfo('key'); } }