示例#1
0
 public function addOutputFromPluginStoresOutput()
 {
     $response = new Response();
     $plugin = $this->getMockBuilder('NamelessCoder\\Gizzle\\PluginInterface')->getMockForAbstractClass();
     $hash = get_class($plugin) . ':' . spl_object_hash($plugin);
     $expected = array($hash => array('foo' => 'bar'));
     $response->addOutputFromPlugin($plugin, array('foo' => 'bar'));
     $this->assertEquals($expected, $response->getOutput());
 }
示例#2
0
 /**
  * @param PluginInterface $plugin
  * @param string $eventSetting
  */
 protected function dispatchPluginEvent(PluginInterface $plugin, $eventSetting)
 {
     $events = $plugin->getSetting($eventSetting);
     if (TRUE === is_array($events)) {
         $plugins = $this->loadPluginInstances($events);
         foreach ($plugins as $eventPlugin) {
             $error = $this->executePlugin($eventPlugin, FALSE);
             if (TRUE === $error instanceof \RuntimeException) {
                 $this->response->addOutputFromPlugin($plugin, array('Event error: ' . $eventSetting));
                 $this->response->addOutputFromPlugin($plugin, array($error->getMessage()));
             }
         }
     }
 }