예제 #1
0
 public function testSetGetResult()
 {
     // Default
     $this->assertNull($this->event->getResult());
     // Test
     $testValue = 'foo';
     $this->assertSame($this->event, $this->event->setResult($testValue));
     $this->assertSame($testValue, $this->event->getResult());
 }
 /**
  * Render the processor result.
  *
  * The result is rendered triggering a "render" event on a cloned MvcEvent,
  * simulating the usual MVC render flow.
  *
  * @todo investigate if simulation works in all cases
  * @param ProcessEvent $e
  */
 public function postProcess(ProcessEvent $e)
 {
     $appEvent = clone $e->getWorker()->getEvent();
     $appEvent->setTarget($appEvent->getApplication());
     $appEvents = $appEvent->getApplication()->getEventManager();
     $appResponse = clone $appEvent->getResponse();
     $appEvent->setResponse($appResponse);
     $appEvent->setResult($e->getResult());
     $appEvents->trigger(MvcEvent::EVENT_RENDER, $appEvent);
     $e->setResult($appEvent->getResponse()->getContent());
     if (Console::isConsole() && is_string($e->getResult())) {
         echo $e->getResult();
     }
 }