From 5c70413784aac7ad98fb0a08ffba1acc8ff21ec2 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 25 Jun 2019 22:52:07 +0100 Subject: [PATCH] Fixed incorrect testing vars and reset env vars in config test --- phpunit.xml | 4 ++-- tests/Unit/ConfigTest.php | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 0e51f6af1..53722a71b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -34,8 +34,8 @@ - - + + diff --git a/tests/Unit/ConfigTest.php b/tests/Unit/ConfigTest.php index 45f7b079d..967915af9 100644 --- a/tests/Unit/ConfigTest.php +++ b/tests/Unit/ConfigTest.php @@ -16,6 +16,8 @@ class ConfigTest extends TestCase $this->checkEnvConfigResult('STORAGE_IMAGE_TYPE', 's3', 'filesystems.images', 's3'); $this->checkEnvConfigResult('STORAGE_IMAGE_TYPE', null, 'filesystems.images', 'local_secure'); + + putenv('STORAGE_TYPE=local'); } public function test_filesystem_attachments_falls_back_to_storage_type_var() @@ -24,6 +26,8 @@ class ConfigTest extends TestCase $this->checkEnvConfigResult('STORAGE_ATTACHMENT_TYPE', 's3', 'filesystems.attachments', 's3'); $this->checkEnvConfigResult('STORAGE_ATTACHMENT_TYPE', null, 'filesystems.attachments', 'local_secure'); + + putenv('STORAGE_TYPE=local'); } public function test_app_url_blank_if_old_default_value() @@ -45,10 +49,12 @@ class ConfigTest extends TestCase */ protected function checkEnvConfigResult(string $envName, $envVal, string $configKey, string $expectedResult) { + $originalVal = getenv($envName); $envString = $envName . (is_null($envVal) ? '' : '=') . ($envVal ?? ''); putenv($envString); $this->refreshApplication(); $this->assertEquals($expectedResult, config($configKey)); + putenv($envString = $envName . (empty($originalVal) ? '' : '=') . ($originalVal ?? '')); } } \ No newline at end of file