setConnection() public method

Sets the current connection.
public setConnection ( Phergie_Connection $connection ) : Phergie_Plugin_Abstract
$connection Phergie_Connection Connection
return Phergie_Plugin_Abstract Provides a fluent interface
Beispiel #1
0
 /**
  * Initializes instance properties.
  *
  * @return void
  */
 public function setUp()
 {
     if (empty($this->pluginClass)) {
         $this->pluginClass = preg_replace('/Test$/', '', get_class($this));
     }
     if (empty($this->plugin)) {
         $this->plugin = new $this->pluginClass();
     }
     $this->plugin->setConfig($this->getMockConfig());
     $this->plugin->setConnection($this->getMockConnection());
     $this->plugin->setEventHandler($this->getMockEventHandler());
     $this->plugin->setPluginHandler($this->getMockPluginHandler());
 }
Beispiel #2
0
 /**
  * Sets the plugin to be tested
  * If a plugin requries config for testing, an array placed in
  * $this->config will be parsed into a Phergie_Config object and
  * attached to the plugin
  */
 protected function setPlugin(Phergie_Plugin_Abstract $plugin)
 {
     $this->plugin = $plugin;
     $this->plugin->setEventHandler($this->handler);
     $this->plugin->setConnection($this->connection);
     $this->connection->setNick('test');
     if (!empty($this->config)) {
         $config = new Phergie_Config();
         foreach ($this->config as $configKey => $configValue) {
             $config[$configKey] = $configValue;
         }
         $plugin->setConfig($config);
     }
 }
Beispiel #3
0
 /**
  * Initializes instance properties.
  *
  * @return void
  */
 public function setUp()
 {
     if (empty($this->pluginClass)) {
         $this->pluginClass = preg_replace('/Test$/', '', get_class($this));
     }
     if (empty($this->plugin)) {
         $this->plugin = new $this->pluginClass();
     }
     $this->plugin->setConfig($this->getMockConfig());
     $this->plugin->setConnection($this->getMockConnection());
     $this->plugin->setEventHandler($this->getMockEventHandler());
     $plugins = $this->getMockPluginHandler();
     $plugins->expects($this->any())->method('getPlugin')->will($this->returnCallback(array($this, 'requirePlugin')));
     $plugins->expects($this->any())->method('removePlugin')->will($this->returnCallback(array($this, 'removePlugin')));
     $this->plugin->setPluginHandler($plugins);
     $this->mockPlugins = array();
     $this->expectedRequiredPlugins = array();
     $this->actualRequiredPlugins = array();
     $this->expectedRemovedPlugins = array();
     $this->actualRemovedPlugins = array();
 }