コード例 #1
0
 public function testCallWithNewRequest()
 {
     $masterRequest = new Request();
     $masterRequest->server->set('REQUEST_URI', '1');
     $application = new Application(new \ArrayObject(), $masterRequest);
     $application->any('1', function (FrontController $frontController) {
         $currentRequest = new Request();
         $currentRequest->server->set('REQUEST_URI', '2');
         return $frontController->call($currentRequest);
     });
     $application->any('2', function (Request $request, RequestStack $requestStack) {
         return $requestStack->getMasterRequest()->getRequestUri() . '-' . $requestStack->getCurrentRequest()->getRequestUri() . '-' . $request->getRequestUri();
     });
     $this->expectOutputString('1-2-2');
     $application->run();
 }
コード例 #2
0
 /**
  * init the module.
  *
  * @param Application $application
  */
 public function init(Application $application)
 {
     $application->addService('staticController', new StaticControllerService());
     $application->any(':all', $application->getService('staticController'));
 }