Example #1
0
 public static function setUpBeforeClass()
 {
     self::$path = sys_get_temp_dir() . '/mindaphp_test';
     Router::$baseUrl = '/';
     Router::$pageRoot = self::$path . '/pages/';
     Router::$templateRoot = self::$path . '/templates/';
     Router::$executeRedirect = false;
     self::$pages = array('admin/posts/index().php', 'admin/posts/index(admin).phtml', 'admin/posts/view($id).php', 'admin/posts/view(admin).phtml', 'admin/index().php', 'admin/index(admin).phtml', 'admin/login().php', 'admin/login(login).phtml', 'error/forbidden(error).phtml', 'error/method_not_allowed(error).phtml', 'error/not_found(error).phtml', 'home().php', 'home(default).phtml', 'index($slug).php', 'index(default).phtml');
     self::$templates = array('admin.php', 'admin.phtml', 'default.phtml', 'error.phtml', 'login.phtml');
     foreach (self::$pages as $file) {
         $path = Router::$pageRoot . $file;
         if (!file_exists(dirname($path))) {
             mkdir(dirname($path), 0755, true);
         }
         file_put_contents($path, '');
     }
     foreach (self::$templates as $file) {
         $path = Router::$templateRoot . $file;
         if (!file_exists(dirname($path))) {
             mkdir(dirname($path), 0755, true);
         }
         file_put_contents($path, '');
     }
     $_SERVER['SCRIPT_NAME'] = self::$path . '/web/index.php';
 }