Example #1
0
 /**
  * @param Application $application
  */
 private function exampleOfRedirection(Application $application)
 {
     $application->get('redirect-from', function () {
         /**
          * @var AppController $this
          */
         $this->flash()->set('funny', 'redirection done with fun! :)');
         return $this->redirect('redirect-to');
     });
     $application->get('redirect-to', function () {
         /**
          * @var AppController $this
          */
         return $funny = $this->flash()->get('funny', ['no redirection'])[0];
     });
 }
 public function testAfter()
 {
     $masterRequest = new Request();
     $masterRequest->server->set('REQUEST_URI', 'uri1');
     $application = new Application(new \ArrayObject(), $masterRequest);
     $application->get(':all', function (Request $request) {
         return $request->getRequestUri();
     });
     $application->after(function (Response $response) {
         $response->setContent('uri2');
     });
     $this->expectOutputString('uri2');
     $application->run();
 }