/**
  * @test
  */
 public function changingListenerVariableWillBeRespectedWhenDeterminingActionToken()
 {
     $this->request = $this->request->withQueryParams(['mylistener' => 'sample.action']);
     $this->router->setListener('mylistener');
     $this->request = $this->router->resolveActionToken($this->request);
     $this->assertSame('sample.action', $this->request->getAttribute(Router::ACTIONTOKEN_ATTR));
 }
示例#2
0
 /**
  * @inheritDoc
  */
 public function withQueryParams(array $query)
 {
     $self = clone $this;
     $self->serverRequest = $this->serverRequest->withQueryParams($query);
     $self->initializeParsedQueryParams();
     return $self;
 }
 /**
  * @test
  */
 public function routeParamsOverwriteQueryParams()
 {
     $this->request = new ServerRequest([], [], '/user/123', 'GET');
     $this->request = $this->request->withQueryParams(['userId' => '999']);
     $this->request = $this->router->match($this->request);
     $targetRequestAttribute = $this->router->getTargetRequestAttribute();
     $queryParams = $this->request->getQueryParams();
     $this->assertTrue(isset($queryParams['userId']));
     $this->assertSame('123', $queryParams['userId']);
 }
示例#4
0
文件: Request.php 项目: Mosaic/Mosaic
 /**
  * {@inheritdoc}
  */
 public function withQueryParams(array $query)
 {
     return new static($this->wrapped->withQueryParams($query));
 }
示例#5
0
 /**
  * @inheritDoc
  */
 public function parse(ServerRequestInterface $request) : ServerRequestInterface
 {
     parse_str($request->getUri()->getQuery(), $queryParams);
     return $request->withQueryParams($queryParams);
 }
示例#6
0
 /**
  * {@inheritDoc}
  */
 public function withQueryParams(array $query)
 {
     return new self($this->app, $this->psrRequest->withQueryParams($query));
 }
 /**
  * Proxy to ServerRequestInterface::withQueryParams()
  *
  * {@inheritdoc}
  */
 public function withQueryParams(array $query)
 {
     $new = $this->psrRequest->withQueryParams($query);
     return new self($new, $this->originalRequest);
 }
 /**
  * Offers possibility to manipulate the request according to routing result.
  * Returns a new {@link \Psr\Http\Message\ServerRequestInterface}.
  *
  * @param ServerRequestInterface $request
  * @param RoutingResult $routingResult
  * @return ServerRequestInterface
  */
 protected function applyRoutingResult(ServerRequestInterface $request, RoutingResult $routingResult) : ServerRequestInterface
 {
     $routingParams = $routingResult->getParams();
     $params = array_merge($request->getQueryParams(), $routingParams);
     return $request->withQueryParams($params);
 }