mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-28 09:03:07 +03:00
Fix tests not properly unsetting env vars
This commit is contained in:
parent
14ba9fd6a4
commit
1ec950ee1e
2 changed files with 7 additions and 8 deletions
|
@ -8,7 +8,6 @@ use Shlinkio\Shlink\Core\ShortUrl\Model\ShortUrlMode;
|
|||
|
||||
use function date_default_timezone_get;
|
||||
use function file_get_contents;
|
||||
use function getenv;
|
||||
use function is_file;
|
||||
use function Shlinkio\Shlink\Config\env;
|
||||
use function Shlinkio\Shlink\Config\parseEnvVar;
|
||||
|
|
|
@ -25,9 +25,9 @@ class EnvVarsTest extends TestCase
|
|||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
putenv(EnvVars::BASE_PATH->value . '=');
|
||||
putenv(EnvVars::DB_NAME->value . '=');
|
||||
putenv(EnvVars::DB_PASSWORD->value . '_FILE=');
|
||||
putenv(EnvVars::BASE_PATH->value);
|
||||
putenv(EnvVars::DB_NAME->value);
|
||||
putenv(EnvVars::DB_PASSWORD->value . '_FILE');
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideExistingEnvVars')]
|
||||
|
@ -38,9 +38,9 @@ class EnvVarsTest extends TestCase
|
|||
|
||||
public static function provideExistingEnvVars(): iterable
|
||||
{
|
||||
yield 'DB_NAME' => [EnvVars::DB_NAME, true];
|
||||
yield 'BASE_PATH' => [EnvVars::BASE_PATH, true];
|
||||
yield 'DB_DRIVER' => [EnvVars::DB_DRIVER, false];
|
||||
yield 'DB_NAME (is set)' => [EnvVars::DB_NAME, true];
|
||||
yield 'BASE_PATH (is set)' => [EnvVars::BASE_PATH, true];
|
||||
yield 'DB_DRIVER (has default)' => [EnvVars::DB_DRIVER, true];
|
||||
yield 'DEFAULT_REGULAR_404_REDIRECT' => [EnvVars::DEFAULT_REGULAR_404_REDIRECT, false];
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class EnvVarsTest extends TestCase
|
|||
try {
|
||||
self::assertEquals($expectedPort, EnvVars::DB_PORT->loadFromEnv());
|
||||
} finally {
|
||||
putenv(EnvVars::DB_DRIVER->value . '=');
|
||||
putenv(EnvVars::DB_DRIVER->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue