コード例 #1
0
 /**
  * @test
  */
 public function responderResolverReturnsFirstMatch()
 {
     $domainPayload = new DomainPayload('test');
     $this->action->expects($this->once())->method('prepareAndExecute')->will($this->returnValue($domainPayload));
     $this->router->expects($this->once())->method('resolveActionToken')->will($this->returnValue($this->request));
     $returnValue = $this->buildResponse('<html>', 200);
     $this->responder->expects($this->once())->method('buildResponse')->will($this->returnValue($returnValue));
     $this->responderResolver->expects($this->once())->method('resolve')->will($this->returnValue($this->responder));
     $responderResolver2 = $this->getMock(ResponderResolver::class);
     $responderResolver2->expects($this->never())->method('resolve');
     $this->middleware = $this->getMock(AdroitMiddleware::class, ['resolveAction'], [[], [$this->responderResolver, $responderResolver2], $this->router]);
     $this->middleware->expects($this->once())->method('resolveAction')->will($this->returnValue($this->action));
     $response = $this->middleware->__invoke($this->request, new Response());
     $this->assertSame($returnValue, $response);
 }
コード例 #2
0
 /**
  * Resolves the actionToken from the given $request.
  *
  * @param ServerRequestInterface $request
  * @return ServerRequestInterface
  */
 protected function resolveActionToken(ServerRequestInterface $request)
 {
     return $this->router->resolveActionToken($request);
 }