1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Removed some unused parameters and fixed env test logic

This commit is contained in:
Dan Brown
2019-09-20 01:18:59 +01:00
parent 8b550991a4
commit 7cd956b24b
7 changed files with 19 additions and 25 deletions

View File

@@ -215,13 +215,11 @@ trait SharedTestHelpers
protected function runWithEnv(string $name, $value, callable $callback)
{
Env::disablePutenv();
$originalVal = $_ENV[$name] ?? null;
$originalVal = $_SERVER[$name] ?? null;
if (is_null($value)) {
unset($_ENV[$name]);
unset($_SERVER[$name]);
} else {
$_ENV[$name] = $value;
$_SERVER[$name] = $value;
}
@@ -230,10 +228,8 @@ trait SharedTestHelpers
if (is_null($originalVal)) {
unset($_SERVER[$name]);
unset($_ENV[$name]);
} else {
$_SERVER[$name] = $originalVal;
$_ENV[$name] = $originalVal;
}
}

View File

@@ -20,7 +20,6 @@ class ConfigTest extends TestCase
public function test_filesystem_attachments_falls_back_to_storage_type_var()
{
putenv('STORAGE_TYPE=local_secure');
$this->runWithEnv('STORAGE_TYPE', 'local_secure', function() {
$this->checkEnvConfigResult('STORAGE_ATTACHMENT_TYPE', 's3', 'filesystems.attachments', 's3');
$this->checkEnvConfigResult('STORAGE_ATTACHMENT_TYPE', null, 'filesystems.attachments', 'local_secure');