本文整理汇总了PHP中Zend\Http\PhpEnvironment\Request::setQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setQuery方法的具体用法?PHP Request::setQuery怎么用?PHP Request::setQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Http\PhpEnvironment\Request
的用法示例。
在下文中一共展示了Request::setQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->resource = $resource = new Resource();
$this->controller = $controller = new RestController();
$controller->setResource($resource);
$this->matches = $matches = new RouteMatch([]);
$this->query = $query = new Parameters();
$this->request = $request = new Request();
$request->setQuery($query);
$this->event = new MvcEvent();
$this->event->setTarget($controller);
$this->event->setRouteMatch($matches);
$this->event->setRequest($request);
$this->listener = new RestParametersListener();
}
示例2: testAction
/**
*/
public function testAction()
{
$queryName = uniqid('query');
list($data, $expected) = $this->prepareDataAndExpected();
$user = UserEntityProvider::createEntityWithRandomData();
$request = new Request();
$request->setMethod(Request::METHOD_GET);
$request->setQuery(new Parameters(array('q' => $queryName)));
$this->authControllerPluginMock->expects($this->once())->method('__invoke')->with(null)->will($this->returnSelf());
$this->authControllerPluginMock->expects($this->once())->method('getUser')->willReturn($user);
$this->organizationRepoMock->expects($this->once())->method('getTypeAheadResults')->with($queryName, $user)->willReturn($data);
/** @var JsonModel $result */
$result = $this->controller->dispatch($request);
$this->assertResponseStatusCode(Response::STATUS_CODE_200);
$this->assertSame($expected, $result->getVariables());
}
示例3: testRetrievingASingleValueForParameters
public function testRetrievingASingleValueForParameters()
{
$request = new Request();
$p = new \Zend\Stdlib\Parameters(array('foo' => 'bar'));
$request->setQuery($p);
$request->setPost($p);
$request->setFiles($p);
$request->setServer($p);
$request->setEnv($p);
$this->assertSame('bar', $request->getQuery('foo'));
$this->assertSame('bar', $request->getPost('foo'));
$this->assertSame('bar', $request->getFiles('foo'));
$this->assertSame('bar', $request->getServer('foo'));
$this->assertSame('bar', $request->getEnv('foo'));
$headers = new Headers();
$h = new GenericHeader('foo', 'bar');
$headers->addHeader($h);
$request->setHeaders($headers);
$this->assertSame($headers, $request->getHeaders());
$this->assertSame($h, $request->getHeaders()->get('foo'));
$this->assertSame($h, $request->getHeader('foo'));
}