Exemplo n.º 1
0
 public function testProcessActionPerform()
 {
     $method = self::getMethod('processActionPerform');
     $mapping = $this->actionConfig1;
     $action = ClassLoader::newInstance($this->actionConfig1->getType(), '\\Phruts\\Action\\Action');
     $form = null;
     $method->invokeArgs($this->requestProcessor, array($this->request, $this->response, $action, $form, $mapping));
 }
Exemplo n.º 2
0
 /**
  * Return a Action instance that will be used to process the current
  * request, creating a new one if necessary.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request The kernel request we are
  * processing
  * @param \Symfony\Component\HttpFoundation\Response $response The kernel response we are
  * creating
  * @param \Phruts\Action\ActionMapping $mapping The mapping we are using
  * @return \Phruts\Config\ForwardConfig
  */
 protected function processActionCreate(\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\HttpFoundation\Response $response, \Phruts\Action\ActionMapping $mapping)
 {
     // Acquire the Action instance we will be using (if there is one)
     $className = $mapping->getType();
     if (!empty($this->log)) {
         $this->log->debug('  Looking for Action instance for class ' . $className);
     }
     $instance = null;
     // Return any existing Action instance of this class
     if (array_key_exists($className, $this->actions)) {
         $instance = $this->actions[$className];
     }
     if (!is_null($instance)) {
         if (!empty($this->log)) {
             $this->log->debug('  Returning existing Action instance');
         }
         return $instance;
     }
     // Create an return a new Action instance
     if (!empty($this->log)) {
         $this->log->debug('  Creating new Action instance');
     }
     try {
         $instance = \Phruts\Util\ClassLoader::newInstance($className, '\\Phruts\\Action\\Action');
     } catch (\Exception $e) {
         $msg = $this->getInternal()->getMessage(null, 'actionCreate', $mapping->getPath());
         if (!empty($this->log)) {
             $this->log->error($msg . ' - ' . $e->getMessage());
         }
         throw new HttpException(500, $msg);
     }
     $instance->setActionKernel($this->actionKernel);
     $this->actions[$className] = $instance;
     return $instance;
 }