public function testAwaitingStop()
 {
     // Default
     $this->assertTrue($this->worker->isAwaitingStopped());
     $this->worker->stopAwaiting();
     $this->assertTrue($this->worker->isAwaitingStopped());
 }
 /**
  * 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();
     }
 }
Example #3
0
 public function testSpecializedParametersMayBeSetViaSetParams()
 {
     $processor = new ForwardProcessor();
     $message = new Message();
     $params = ['processor' => $processor, 'message' => $message, 'result' => 'result', 'foo' => 'bar'];
     $this->event->setParams($params);
     $this->assertEquals($params, $this->event->getParams());
     foreach ($params as $param => $expectedValue) {
         if (method_exists($this->event, 'get' . $param)) {
             $this->assertSame($params[$param], $this->event->{'get' . $param}());
         }
         $this->assertSame($params[$param], $this->event->getParam($param));
     }
 }
 /**
  * @return ProcessEvent
  */
 public function getProcessEvent()
 {
     if (null === $this->processEvent) {
         $this->setProcessEvent(new ProcessEvent());
         $this->processEvent->setTarget($this);
     }
     return $this->processEvent;
 }