Skip to content

Commit 920382e

Browse files
committed
Fix phpunit not passing environment variables
1 parent a01cdad commit 920382e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ jobs:
6060
sed -i "s/<version>0.0.0<\/version>/<version>$RELEASE_VERSION<\/version>/g" ./appinfo/info.xml
6161
6262
- name: unittests
63-
env:
64-
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
65-
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
6663
run: |
6764
composer install
6865
./vendor/bin/phpunit --bootstrap tests/unittests/bootstrap.php tests/unittests/ --testdox
@@ -88,10 +85,13 @@ jobs:
8885
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
8986
NEXTCLOUD_HOSTNAME: nextcloud-container
9087
run: |
88+
# Need to dump env into .env because phpunit does not pass them on to tests
89+
printenv | sed "s/'/'\"'\"'/g; s/=/='/; s/$/'/" > .env
9190
curl --fail --show-error --silent --connect-timeout 5 --max-time 10 "http://${NEXTCLOUD_HOSTNAME}/status.php" > /dev/null
9291
curl --fail --show-error --silent --connect-timeout 5 --max-time 10 "http://nextcloud-container/status.php" > /dev/null
9392
bats --verbose-run --timing --trace ./tests/bats
9493
./vendor/bin/phpunit --bootstrap tests/integration/bootstrap.php tests/integration/
94+
rm -f .env
9595
9696
- uses: actions/upload-artifact@master
9797
with:

tests/integration/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ function findEnvDirectory(string $startDir): ?string {
3333
$envDir = findEnvDirectory(__DIR__);
3434

3535
if ($envDir !== null) {
36-
$dotenv = Dotenv::createImmutable($envDir);
36+
$dotenv = Dotenv::createMutable($envDir);
3737
$dotenv->safeLoad();
3838
}

0 commit comments

Comments
 (0)