From 0dcffc50e199c0959421025f526d3dec82a464af Mon Sep 17 00:00:00 2001 From: Armel van Ravels Date: Fri, 30 Aug 2024 22:39:46 +0200 Subject: [PATCH] Add startup instructions --- .env.example | 1 + Makefile | 4 ++++ README.md | 18 ++++++++++++++++++ tests/Pest.php | 6 ++++++ 4 files changed, 29 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0703741 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +ENVIRONMENT=development diff --git a/Makefile b/Makefile index 4664082..b142425 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ up: start: up composer-install +composer-install: + "$(EXEC)" composer install stop: docker compose stop cmd: @@ -13,3 +15,5 @@ phpstan: "$(EXEC)" vendor/bin/phpstan analyse src --level 8 cs-fix: "$(EXEC)" vendor/bin/php-cs-fixer fix --allow-risky=yes +test: + "$(EXEC)" vendor/bin/pest \ No newline at end of file diff --git a/README.md b/README.md index e69de29..b7d6e92 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,18 @@ +# Armel.net + +### How to run + +``` +cp .env.example .env +make start +``` + +### How to stop +``` +make stop +``` + +### How to test +``` +make test +``` diff --git a/tests/Pest.php b/tests/Pest.php index 5aaff49..bdc7bfc 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -8,6 +8,12 @@ use Psr\Http\Message\ResponseInterface; function get(string $uri, array $headers = [], array $cookies = []): ResponseInterface { + try { + app(\App\Core\EnvironmentLoader::class)->load(\App\Enums\Environment::Testing); + } catch (\Exception) { + app(\App\Core\EnvironmentLoader::class)->load(); + } + $router = app(Router::class); $request = new ServerRequest(uri: $uri, method: 'GET', headers: $headers, cookieParams: $cookies);