/** * 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()); }