Example #1
0
 public function testHandleSuccess()
 {
     $app = new Application();
     $app->get('/', function ($request, $response) {
         $response->setContent('<h1>It works!</h1>');
         return $response;
     });
     $app->post('/', function ($request, $response) {
         $response->setContent('<h1>It works!</h1>');
         return $response;
     });
     $app->put('/', function ($request, $response) {
         $response->setContent('<h1>It works!</h1>');
         return $response;
     });
     $app->delete('/', function ($request, $response) {
         $response->setContent('<h1>It works!</h1>');
         return $response;
     });
     $app->patch('/', function ($request, $response) {
         $response->setContent('<h1>It works!</h1>');
         return $response;
     });
     $request = Request::createFromGlobals();
     $response = $app->handle($request, 1, true);
     $this->assertEquals('<h1>It works!</h1>', $response->getContent());
 }
 /**
  * Bootstraps the application
  *
  * @param Application $app
  *
  * @return Application
  */
 public function load(Application $app)
 {
     $app->get('/', 'Indigo\\Service\\Controller\\MainController::index');
     $app->get('/services', 'Indigo\\Service\\Controller\\ServiceController::listAction');
     $app->get('/services/create', 'Indigo\\Service\\Controller\\ServiceController::createAction');
     $app->post('/services', 'Indigo\\Service\\Controller\\ServiceController::create');
     $app->get('/services/{id}', 'Indigo\\Service\\Controller\\ServiceController::read');
     $app->post('/services/{id}/comment', 'Indigo\\Service\\Controller\\ServiceController::createComment');
     $app->get('/services/{id}/edit', 'Indigo\\Service\\Controller\\ServiceController::updateAction');
     $app->post('/services/{id}', 'Indigo\\Service\\Controller\\ServiceController::update');
     $app->delete('/services/{id}', 'Indigo\\Service\\Controller\\ServiceController::delete');
     $app->get('/services/print/{id}', 'Indigo\\Service\\Controller\\ServiceController::pdf');
     $app->get('/login', 'Indigo\\Service\\Controller\\AuthController::login');
     $app->post('/login', 'Indigo\\Service\\Controller\\AuthController::processLogin');
     $baseUriListener = new BaseUri();
     $baseUriListener->setApplication($app);
     $app->subscribe('request.received', $baseUriListener);
     return $app;
 }