Overrides the parent class to set the currently active socket handler
when the active connection is changed.
public setConnection ( Phergie_Connection $connection ) : Phergie_Driver_Streams | ||
$connection | Phergie_Connection | Active connection |
Результат | Phergie_Driver_Streams | Provides a fluent interface |
/** * Tests that a connection can be made the active connection following * its initial establishment. * * @return void * @depends testSetConnectionWithNewConnection * @depends testDoConnectWithoutPassword */ public function testSetConnectionWithExistingConnection() { $this->server->get(); $this->server->run(); $connection = $this->getMockConnection(); $this->driver->setConnection($connection); $this->driver->doConnect(); $this->driver->setConnection($connection); $this->driver->doQuit(); $this->server->close(); }
/** * 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()); }