setConfig() public method

Sets the current configuration handler.
public setConfig ( Phergie_Config $config ) : Phergie_Plugin_Abstract
$config Phergie_Config Configuration handler
return Phergie_Plugin_Abstract Provides a fluent interface
Ejemplo n.º 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());
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
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);
     }
 }