Пример #1
0
 /**
  * Constructor for a request.
  *
  * @param string $controller The controller being requested.
  * @param object $payload The action being invoked.
  * @param string $verb (optional) The HTTP verb (usually POST).
  */
 public function __construct($controller, $payload, $verb = 'POST')
 {
     // extract a minimal "action" value from the payload
     $action = '';
     if (is_object($payload) && isset($payload->method)) {
         $action = $payload->method;
     }
     parent::__construct($controller, $action, $verb);
     $this->payload = $payload;
 }
Пример #2
0
 /**
  * Tests the various filters.
  * @dataProvider filtersProvider
  */
 public function testInputFilters($expected, $value, $filters)
 {
     $request = new HttpRequest('TestService', 'TestMethod', 'GET');
     $request->setQuery(array('key' => $value));
     $this->assertTrue($expected === $request->getQuery('key', null, $filters));
 }