Skip to content

Commit 4fae535

Browse files
committed
fix: Fix incorrect serve command location
1 parent f588279 commit 4fae535

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

core/Application.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ class Application {
1414

1515
public function __construct() {
1616
self::$app = $this;
17+
self::$ROOT_DIR = dirname(__DIR__);
1718

1819
$this->view = new View();
1920
$this->request = new Request();
2021
$this->response = new Response();
2122
$this->router = new Router($this->request, $this->response);
2223
$this->session = new Session();
23-
24-
self::$ROOT_DIR = dirname(__DIR__);
2524
}
2625

2726
public static function router(): Router {

core/Console/Commands/Serve.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Serve extends Command {
77
public function handle(): void {
88
$format = 'cd %s && php -S localhost:%d';
9-
$dir = ROOT . '/' . @$this->flags['--test'] ?? 'public';
9+
$dir = ROOT . '/' . (in_array('--test', $this->flags) ? 'tests' : 'public');
1010
$port = @$this->args[0] ?? 8080;
1111

1212
exec(sprintf($format, $dir, $port));

public/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
$app = new Application();
1313

14-
$app->router()->get('/', 'app>index');
14+
$app->router()->get('/', 'layouts/app>index');
1515

1616
$app->run();
File renamed without changes.

0 commit comments

Comments
 (0)