Пример #1
0
 function testConnection_ConnectionTimeout()
 {
     $timeout = 3;
     $args = array('host' => '1.0.0.1', 'connection_timeout' => $timeout);
     $connection = new Predis_Connection(new Predis_ConnectionParameters($args));
     $start = time();
     $thrownException = null;
     try {
         $connection->connect();
     } catch (Predis_CommunicationException $exception) {
         $thrownException = $exception;
     }
     $this->assertInstanceOf('Predis_CommunicationException', $thrownException);
     $this->assertEquals((double) (time() - $start), $timeout, '', 1);
 }