public function getDefault() { return Predis_RedisServerProfile::getDefault(); }
function testConnection_ReadTimeout() { $timeout = 1; $args = array_merge(RC::getConnectionArguments(), array('read_write_timeout' => $timeout)); $cmdFake = Predis_RedisServerProfile::getDefault()->createCommand('ping'); $connection = new Predis_Connection(new Predis_ConnectionParameters($args)); $expectedMessage = 'Error while reading line from the server'; $start = time(); $thrownException = null; try { $connection->readResponse($cmdFake); } catch (Predis_CommunicationException $exception) { $thrownException = $exception; } $this->assertInstanceOf('Predis_CommunicationException', $thrownException); $this->assertEquals($expectedMessage, $thrownException->getMessage()); $this->assertEquals((double) (time() - $start), $timeout, '', 1); }