Skip to content

Commit b2e1000

Browse files
committed
Allow local test suite to be configured via .env.testing
1 parent 3591889 commit b2e1000

File tree

6 files changed

+320
-5
lines changed

6 files changed

+320
-5
lines changed

agent/.env.example

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NIGHTWATCH_BASE_URL=
2+
NIGHTWATCH_TOKEN=
3+
NIGHTWATCH_DEBUG=true

agent/.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/*.md export-ignore
1010
/.editorconfig export-ignore
11+
/.env.example export-ignore
1112
/.gitattributes export-ignore
1213
/.github export-ignore
1314
/.gitignore export-ignore

agent/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.box_dump
2+
/.env.testing
23
/.phpunit.result.cache
34
/box.json
45
/phpstan.neon

agent/composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"pestphp/pest": "^3.7.4",
3232
"phpstan/phpstan": "^2.1.6",
3333
"phpunit/phpunit": "^11.5.3",
34-
"symfony/process": "^7.2"
34+
"symfony/process": "^7.2",
35+
"vlucas/phpdotenv": "^5.6"
3536
},
3637
"autoload": {
3738
"psr-4": {

agent/composer.lock

+303-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/tests/Pest.php

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
<?php
22

3+
if ($_SERVER['CI'] ?? false) {
4+
try {
5+
Dotenv\Dotenv::createImmutable(__DIR__.'/../', '.env.testing')->load();
6+
} catch (Dotenv\Exception\InvalidPathException $e) {
7+
echo 'You have not configured your local `.env.testing` file. Please run `cp .env.example .env.testing` and configure the variables as needed.';
8+
9+
exit(1);
10+
}
11+
}
12+
313
pest()->extends(Tests\TestCase::class);

0 commit comments

Comments
 (0)