diff --git a/.gitattributes b/.gitattributes index 5471d4b..16f7426 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ /tests export-ignore /.github export-ignore +/.phpunit.cache export-ignore .gitattributes export-ignore .gitignore export-ignore .phpunit.result.cache export-ignore diff --git a/composer.json b/composer.json index 7af20e9..f83ee4a 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "homepage": "https://github.com/PhpSlides", "type": "library", "license": "MIT", - "keywords": [ "framework", "phpslides" ], + "keywords": ["framework", "phpslides"], "support": { "issues": "https://github.com/PhpSlides/framework/issues", "source": "https://github.com/PhpSlides/framework" @@ -31,22 +31,23 @@ }, "autoload": { "psr-4": { - "PhpSlides\\": [ "src/Exception/" ], - "PhpSlides\\Src\\": [ "src/" ], - "PhpSlides\\Router\\": [ "Router/" ] + "PhpSlides\\": "src/Exception/", + "PhpSlides\\Src\\": "src/", + "PhpSlides\\Router\\": "Router/" }, - "files": [ "src/Bootstrap/App.php" ] + "files": ["src/Bootstrap/App.php"] }, "autoload-dev": { "psr-4": { - "PhpSlides\\Tests\\": "tests/" + "PhpSlides\\Tests\\": "tests/tests/" } }, "config": { "preferred-install": "dist" }, "scripts": { - "test": "vendor/bin/phpunit" + "test": "vendor/bin/phpunit", + "phpunit": "php vendor/bin/phpunit" }, "minimum-stability": "stable", "prefer-stable": true diff --git a/src/Cli/Configure.php b/src/Cli/Configure.php index 7bde90c..e05090e 100644 --- a/src/Cli/Configure.php +++ b/src/Cli/Configure.php @@ -1,21 +1,19 @@ load(__DIR__ . '/../Config/env.config.php') - ->load(__DIR__ . '/../Config/config.php'); + ->load(__DIR__ . '/../Config/env.config.php') + ->load(__DIR__ . '/../Config/config.php'); session_start(); @@ -171,11 +165,9 @@ public function create (): void $sid = session_id(); - if (getenv('HOT_RELOAD') == 'true') - { - Route::post("/hot-reload-a$sid", fn () => (new HotReload())->reload()); - Route::get("/hot-reload-a$sid/worker", function () use ($sid): string - { + if (getenv('HOT_RELOAD') == 'true') { + Route::post("/hot-reload-a$sid", fn() => (new HotReload())->reload()); + Route::get("/hot-reload-a$sid/worker", function () use ($sid): string { $addr = self::$REMOTE_ADDR . "/hot-reload-a$sid"; header('Content-Type: application/javascript'); @@ -184,13 +176,10 @@ public function create (): void Render::WebRoute(); } - try - { + try { Connection::init(); DB::query('SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA'); - } - catch ( \Exception $e ) - { + } catch (\Exception $e) { Database::$_connect_error = $e->getMessage(); goto EXECUTION; } @@ -198,8 +187,7 @@ public function create (): void new Autoloader(); EXECUTION: - try - { + try { $loader->load(__DIR__ . '/../Globals/Functions.php'); $config_file = self::config_file(); @@ -209,14 +197,11 @@ public function create (): void header("Content-Type: text/html; charset=$charset"); self::config(); - } - catch ( \Exception $e ) - { + } catch (\Exception $e) { http_response_code(500); static::log(); - if (function_exists('ExceptionHandler')) - { + if (function_exists('ExceptionHandler')) { call_user_func('ExceptionHandler', $e); } } diff --git a/tests/.env b/tests/.env index e69de29..df8e5b7 100644 --- a/tests/.env +++ b/tests/.env @@ -0,0 +1 @@ +APP_NAME = 'PhpSlides' \ No newline at end of file