mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Ensure proper env vars are promoted for dev and test envs
This commit is contained in:
parent
4520afb271
commit
2a734b5d89
@ -17,12 +17,8 @@ touch $OUTPUT_LOGS
|
|||||||
# Try to stop server just in case it hanged in last execution
|
# Try to stop server just in case it hanged in last execution
|
||||||
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr stop -f -w .
|
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr stop -f -w .
|
||||||
|
|
||||||
# Resolve .env file absolute path, as it fails to load with relative paths
|
|
||||||
TESTS_DOTENV="${PWD}/config/test/shlink-test.env"
|
|
||||||
|
|
||||||
echo 'Starting server...'
|
echo 'Starting server...'
|
||||||
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr serve -p -w . -c=config/roadrunner/.rr.test.yml \
|
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr serve -p -w . -c=config/roadrunner/.rr.test.yml \
|
||||||
--dotenv "$TESTS_DOTENV" \
|
|
||||||
-o=logs.output="${PWD}/${OUTPUT_LOGS}" \
|
-o=logs.output="${PWD}/${OUTPUT_LOGS}" \
|
||||||
-o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
|
-o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
|
||||||
-o=logs.channels.server.output="${PWD}/${OUTPUT_LOGS}" &
|
-o=logs.channels.server.output="${PWD}/${OUTPUT_LOGS}" &
|
||||||
|
@ -7,11 +7,6 @@ export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"
|
|||||||
|
|
||||||
[ "$GENERATE_COVERAGE" != 'no' ] && export XDEBUG_MODE=coverage
|
[ "$GENERATE_COVERAGE" != 'no' ] && export XDEBUG_MODE=coverage
|
||||||
|
|
||||||
# Load and export test env vars
|
|
||||||
set -a
|
|
||||||
. ./config/test/shlink-test.env
|
|
||||||
set +a
|
|
||||||
|
|
||||||
vendor/bin/phpunit --order-by=random --testdox --testdox-summary -c phpunit-cli.xml $*
|
vendor/bin/phpunit --order-by=random --testdox --testdox-summary -c phpunit-cli.xml $*
|
||||||
TESTS_EXIT_CODE=$?
|
TESTS_EXIT_CODE=$?
|
||||||
|
|
||||||
|
@ -15,8 +15,11 @@ chdir(dirname(__DIR__));
|
|||||||
|
|
||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
// Promote env vars from installer or dev config
|
// Promote env vars from installer, dev config or test config
|
||||||
loadEnvVarsFromConfig('config/params/*.php', enumValues(EnvVars::class));
|
loadEnvVarsFromConfig(
|
||||||
|
EnvVars::isTestEnv() ? 'config/test/shlink_test_env.php' : 'config/params/*.php',
|
||||||
|
enumValues(EnvVars::class),
|
||||||
|
);
|
||||||
|
|
||||||
// This is one of the first files loaded. Configure the timezone and memory limit here
|
// This is one of the first files loaded. Configure the timezone and memory limit here
|
||||||
ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv());
|
ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv());
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
APP_ENV=test
|
|
||||||
|
|
||||||
# URL shortener
|
|
||||||
DEFAULT_DOMAIN=s.test
|
|
||||||
IS_HTTPS_ENABLED=false
|
|
15
config/test/shlink_test_env.php
Normal file
15
config/test/shlink_test_env.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
EnvVars::APP_ENV->value => 'test',
|
||||||
|
|
||||||
|
// URL shortener
|
||||||
|
EnvVars::DEFAULT_DOMAIN->value => 's.test',
|
||||||
|
EnvVars::IS_HTTPS_ENABLED->value => false,
|
||||||
|
|
||||||
|
];
|
Loading…
Reference in New Issue
Block a user