doQuit() public method

Terminates the connection with the server.
public doQuit ( string $reason = null ) : void
$reason string Reason for connection termination (optional)
return void
示例#1
0
 /**
  * Tests attempting to get a new event on the active connection when no
  * data is available.
  *
  * @return void
  * @depends testSetConnectionWithNewConnection
  * @depends testDoConnectWithoutPassword
  */
 public function testGetEventWithNoData()
 {
     $this->acceptAllCommands();
     $connection = $this->getMockConnection();
     $this->driver->setConnection($connection);
     $this->driver->doConnect();
     $result = $this->driver->getEvent();
     $this->driver->doQuit();
     $this->assertNull($result);
 }
示例#2
0
 /**
  * Tests that an attempt to send a command without an active connection
  * results in an exception.
  *
  * @return void
  */
 public function testSendWithoutConnectionThrowsException()
 {
     try {
         $this->driver->doQuit();
         $this->fail('Expected exception not thrown');
     } catch (Phergie_Driver_Exception $e) {
         if ($e->getCode() != Phergie_Driver_Exception::ERR_NO_ACTIVE_CONNECTION) {
             $this->fail('Unexpected exception code: ' . $e->getCode());
         }
     }
 }