Esempio n. 1
0
 /**
  * @param \Tonic\Application $app
  * @param \Tonic\Request $request
  * @param \Tonic\ResourceMetadata $resourceMetadata
  */
 function let($app, $request, $resourceMetadata, $sayHello, $sayHelloInFrench, $replicants, $iveSeenThings, $sayHelloComputer, $feedTheComputer)
 {
     $request->getMethod()->willReturn('GET');
     $request->getParams()->willReturn(array());
     $request->getAccept()->willReturn(array());
     $request->getAcceptLanguage()->willReturn(array());
     $sayHello->beADoubleOf('\\Tonic\\MethodMetadata');
     $sayHello->getConditions()->willReturn(array('method' => array('GET')));
     $sayHelloInFrench->beADoubleOf('\\Tonic\\MethodMetadata');
     $sayHelloInFrench->getConditions()->willReturn(array('method' => array('GET'), 'lang' => array('fr')));
     $replicants->beADoubleOf('\\Tonic\\MethodMetadata');
     $replicants->getConditions()->willReturn(array('method' => array('GET'), 'priority' => array(2), 'only' => array('deckard')));
     $iveSeenThings->beADoubleOf('\\Tonic\\MethodMetadata');
     $iveSeenThings->getConditions()->willReturn(array('method' => array('GET'), 'priority' => array(2), 'only' => array('roy')));
     $sayHelloComputer->beADoubleOf('\\Tonic\\MethodMetadata');
     $sayHelloComputer->getConditions()->willReturn(array('method' => array('GET'), 'provides' => array('application/json'), 'json' => array()));
     $feedTheComputer->beADoubleOf('\\Tonic\\MethodMetadata');
     $feedTheComputer->getConditions()->willReturn(array('method' => array('POST'), 'accepts' => array('application/json'), 'provides' => array('application/json'), 'json' => array()));
     $resourceMetadata->getClass()->willReturn('\\Tyrell\\Hello');
     $resourceMetadata->getUri()->willReturn(array(array('/hello')));
     $resourceMetadata->getMethod('setup')->willReturn(null);
     $resourceMetadata->getMethods()->willReturn(array('sayHello' => $sayHello, 'sayHelloInFrench' => $sayHelloInFrench, 'replicants' => $replicants, 'iveSeenThings' => $iveSeenThings, 'sayHelloComputer' => $sayHelloComputer, 'feedTheComputer' => $feedTheComputer));
     $resourceMetadata->getMethod('setup')->willReturn(null);
     $app->getResourceMetadata(\Prophecy\Argument::any())->willReturn($resourceMetadata);
     $this->beConstructedWith($app, $request);
 }
Esempio n. 2
0
 /**
  * @param \Tonic\Application $app
  * @param \Tonic\Request $request
  * @param \Tonic\ResourceMetadata $resourceMetadata
  */
 function let($app, $request, $resourceMetadata, $mySecret)
 {
     $request->getMethod()->willReturn('GET');
     $request->getParams()->willReturn(array());
     $request->getAccept()->willReturn(array());
     $request->getAcceptLanguage()->willReturn(array());
     $mySecret->beADoubleOf('\\Tonic\\MethodMetadata');
     $mySecret->getConditions()->willReturn(array('method' => array('GET'), 'secure' => array('aUser aPassword')));
     $resourceMetadata->getClass()->willReturn('\\Tyrell\\Secret');
     $resourceMetadata->getUri()->willReturn(array(array('/secret')));
     $resourceMetadata->getMethod('setup')->willReturn(null);
     $resourceMetadata->getMethods()->willReturn(array('mySecret' => $mySecret));
     $resourceMetadata->getMethod('setup')->willReturn(null);
     $app->getResourceMetadata(\Prophecy\Argument::any())->willReturn($resourceMetadata);
     $this->beConstructedWith($app, $request);
 }