Author: Phergie Development Team (team@phergie.org)
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 description for the command on the plugin instance
  * 
  * @param Phergie_Plugin_Abstract $plugin      plugin instance
  * @param string                  $command     from onCommand method
  * @param string                  $description command description
  *
  * @return void
  */
 public function setCommandDescription(Phergie_Plugin_Abstract $plugin, $command, array $description)
 {
     $this->registry[strtolower($plugin->getName())]['cmd'][$command] = $description;
 }
Ejemplo n.º 4
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);
     }
 }