/** * Initiate connection * * @return void */ public function connect() { if (!$this->conn) { $this->conn = new Phergie_StatusnetBot(); $config = new Phergie_Config(); $config->readArray(array('connections' => array(array('host' => $this->plugin->host, 'port' => $this->plugin->port, 'username' => $this->plugin->username, 'realname' => $this->plugin->realname, 'nick' => $this->plugin->nick, 'password' => $this->plugin->password, 'transport' => $this->plugin->transporttype, 'encoding' => $this->plugin->encoding)), 'driver' => 'statusnet', 'processor' => 'async', 'processor.options' => array('sec' => 0, 'usec' => 0), 'plugins' => array('Pong', 'NickServ', 'AutoJoin', 'Statusnet'), 'plugins.autoload' => true, 'nickserv.password' => $this->plugin->nickservpassword, 'nickserv.identify_message' => $this->plugin->nickservidentifyregexp, 'autojoin.channels' => $this->plugin->channels, 'statusnet.messagecallback' => array($this, 'handle_irc_message'), 'statusnet.regcallback' => array($this, 'handle_reg_response'), 'statusnet.connectedcallback' => array($this, 'handle_connected'), 'statusnet.unregregexp' => $this->plugin->unregregexp, 'statusnet.regregexp' => $this->plugin->regregexp)); $this->conn->setConfig($config); $this->conn->connect(); $this->lastPing = time(); $this->lastMessage = time(); } return $this->conn; }
/** * Tests that the configuration object is able to read an associative * array. * * @return void * @depends testImplementsOffsetExists * @depends testImplementsOffsetGet */ public function testReadArray() { $returned = $this->config->readArray(array('foo' => 'bar')); $this->assertSame($this->config, $returned, 'readArray() does not implement a fluent interface'); $this->assertEquals($this->config['foo'], 'bar'); }