getCommand(); $command->setArguments($arguments); $this->assertSame($expected, $command->getArguments()); } /** * @group disconnected */ public function testParseResponse(): void { $this->assertSame('OK', $this->getCommand()->parseResponse('OK')); } /** * @group connected */ public function testCanSelectDifferentDatabase(): void { $redis = $this->getClient(); $redis->set('foo', 'bar'); $this->assertEquals('OK', $redis->select(REDIS_SERVER_DBNUM + 1)); $this->assertSame(0, $redis->exists('foo')); } /** * @group connected */ public function testThrowsExceptionOnUnexpectedDatabaseRange(): void { $this->expectException('Predis\Response\ServerException'); $this->expectExceptionMessageMatches('/ERR.*DB index/'); $redis = $this->getClient(); $redis->select(100000000); } /** * @group connected */ public function testThrowsExceptionOnUnexpectedDatabaseName(): void { $this->expectException('Predis\Response\ServerException'); $this->expectExceptionMessageMatches('/ERR.*(invalid DB index|value is not an integer or out of range)/'); $redis = $this->getClient(); $redis->select('x'); } }