Author: Phergie Development Team (team@phergie.org)
Inheritance: extends Phergie_Driver_Abstract
Example #1
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());
         }
     }
 }
Example #2
0
 /**
  * Tests reception of a response event from a server.
  *
  * @return void
  * @depends testSetConnectionWithNewConnection
  * @depends testDoConnectWithoutPassword
  */
 public function testGetEventWithServerResponse()
 {
     $this->acceptAllCommands();
     $connection = $this->getMockConnection();
     $this->driver->setConnection($connection);
     $this->driver->doConnect();
     $this->writeEventToSocket(0, ':verne.freenode.net 376 Phergie :End of /MOTD command.');
     $event = $this->driver->getEvent();
     $this->assertInstanceOf('Phergie_Event_Response', $event);
     $this->assertEquals('response', $event->getType());
     $this->assertEquals('376', $event->getCode());
     $this->assertEquals('End of /MOTD command.', $event->getDescription());
 }
Example #3
0
 /**
  * Handles construction of command strings and their transmission to the
  * server.
  *
  * @param string       $command Command to send
  * @param string|array $args    Optional string or array of sequential
  *        arguments
  *
  * @return string Command string that was sent
  * @throws Phergie_Driver_Exception
  */
 public function send($command, $args = '')
 {
     return parent::send($command, $args);
 }