Exemplo n.º 1
0
 public function testPost()
 {
     $route = Route::post('account/preferences', ['controller' => 'Account', 'action' => 'preferences']);
     $this->assertTrue($route);
     $route = Route::post('account/preferences', []);
     $this->assertFalse($route);
     $route = Route::post('account/preferences', ['controller' => 'Account']);
     $this->assertFalse($route);
     $route = Route::post('account/preferences', ['action' => 'preferences']);
     $this->assertFalse($route);
 }
Exemplo n.º 2
0
 /**
  * Load the application routes.
  *
  * @return void
  */
 private static function routes()
 {
     // Load the routes file from each module that has it.
     foreach (scandir(path('modules')) as $module) {
         // Ensure its not a hidden folder.
         if (in_array($module, ['.', '..'], true)) {
             continue;
         }
         // Set the module.
         Route::$module = $module;
         // Load file is exists.
         if (is_file($path = path('modules', $module) . 'routes.php')) {
             require_once $path;
         }
     }
     // Rewrite the application routes.
     static::rewrite();
 }