コード例 #1
0
 /**
  * Overrides Composite bind() method, defining what is the current action
  * and forwarding the call to it.
  *
  * @param \Nethgui\Controller\RequestInterface $request 
  */
 public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     $this->request = $request;
     $actionId = $this->establishCurrentActionId();
     if ($actionId === FALSE) {
         return;
         // don't bind the request to any action. Render action index.
     }
     $this->currentAction = $this->getAction($actionId);
     if (is_null($this->currentAction)) {
         throw new \Nethgui\Exception\HttpException('Not Found', 404, 1322148401);
     }
     if ($this->currentAction instanceof \Nethgui\Controller\RequestHandlerInterface) {
         $this->currentAction->bind($request->spawnRequest($actionId));
     }
 }
コード例 #2
0
 protected function runModuleTest(\Nethgui\Module\ModuleInterface $module, ModuleTestEnvironment $env)
 {
     $platform = $this->createPlatformMock($env);
     $module->setPlatform($platform);
     $module->initialize();
     if ($module instanceof \Nethgui\Controller\RequestHandlerInterface) {
         $request = $this->createRequestMock($env);
         $validationReport = $this->createValidationReportMock($env);
         $module->bind($request);
         $module->validate($validationReport);
         $module->process();
     }
     $view = $this->createViewMock($module, $env);
     $module->prepareView($view);
     $platform->signalFinalEvents();
     foreach ($env->getView() as $key => $value) {
         $this->assertEquals($value, $view[$key], "View parameter `{$key}`.");
     }
     $this->fullViewOutput = array();
     // obsolete: $view->getClientEvents();
     foreach ($this->dbObjectCheckList as $dbStubInfo) {
         $this->assertTrue($dbStubInfo[1]->getState()->isFinal(), sprintf('Database `%s` is not in final state! %s', $dbStubInfo[0], $dbStubInfo[1]->getState()));
     }
 }