Author: Phergie Development Team (team@phergie.org)
コード例 #1
0
ファイル: TestCase.php プロジェクト: jellydoughnut/phergie
 /**
  * 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());
 }
コード例 #2
0
ファイル: TestCase.php プロジェクト: phergie/phergie
 /**
  * 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();
 }
コード例 #3
0
ファイル: Help.php プロジェクト: Bittarman/phergie
 /**
  * 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;
 }
コード例 #4
0
ファイル: TestCase.php プロジェクト: Bittarman/phergie
 /**
  * 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);
     }
 }