Beispiel #1
0
 public function testCanSetGetParams()
 {
     $payload = new Payload(['foo' => 'bar']);
     $payload->set('controller', 'index');
     $request = new Fake(null);
     $request->injectPayload($payload);
     $this->assertEquals('bar', $request->payload->foo);
     $this->assertEquals('index', $request->payload->controller);
     $this->assertEquals('boo', $request->payload->get('doesnotexist', 'boo'));
 }
Beispiel #2
0
 /**
  * Dispatch the current controller stored within
  * the $class property.
  *
  * Prior to dispatch this method will send the Payload to the Request
  * object stored within the Service Manager. At this point we also call
  * the Payload's prepare method, which prepares the Payload for the Request.
  *
  * It will then execute the controllers preAction method, the action
  * method provided by the payload, then postAction.
  *
  * @return Proem\Dispatch\Standard
  */
 public function dispatch()
 {
     if ($this->assets->has('request')) {
         $this->assets->get('request')->injectPayload($this->payload->prepare());
     }
     $this->class->dispatch($this->action);
     return $this;
 }