Ejemplo n.º 1
0
 function testRouterShouldntFireRouteIfDoesntMatches()
 {
     $request = new Request();
     $route = Mockery::mock('App\\Framework\\Contracts\\Route');
     $route->shouldReceive('matches')->once()->andReturn(false);
     $route->shouldReceive('fire')->never();
     $routes = [$route];
     $router = new Router($routes);
     $router->dispatch($request);
 }
Ejemplo n.º 2
0
 /**
  * Run the Application
  *
  * @return App\Framework\Contracts\Response
  */
 public function run()
 {
     try {
         $dotenv = new Dotenv(__DIR__ . '/../../');
         $dotenv->load();
     } catch (\InvalidArgumentException $e) {
         // Fall through, assume that environment variables
         // are being set some other way...
     }
     $router = new Router($this->routes);
     $request = new Request();
     $response = $router->dispatch($request);
     if (!$response) {
         $response = new Response(404, 'Page not found.');
     }
     return $response;
 }