Skip to content

Commit 5c70413

Browse files
committed
Fixed incorrect testing vars and reset env vars in config test
1 parent 52b4c81 commit 5c70413

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<env name="AVATAR_URL" value=""/>
3535
<env name="LDAP_VERSION" value="3"/>
3636
<env name="STORAGE_TYPE" value="local"/>
37-
<env name="ATTACHMENT_STORAGE_TYPE" value="local"/>
38-
<env name="IMAGE_STORAGE_TYPE" value="local"/>
37+
<env name="STORAGE_ATTACHMENT_TYPE" value="local"/>
38+
<env name="STORAGE_IMAGE_TYPE" value="local"/>
3939
<env name="GITHUB_APP_ID" value="aaaaaaaaaaaaaa"/>
4040
<env name="GITHUB_APP_SECRET" value="aaaaaaaaaaaaaa"/>
4141
<env name="GITHUB_AUTO_REGISTER" value=""/>

tests/Unit/ConfigTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public function test_filesystem_images_falls_back_to_storage_type_var()
1616

1717
$this->checkEnvConfigResult('STORAGE_IMAGE_TYPE', 's3', 'filesystems.images', 's3');
1818
$this->checkEnvConfigResult('STORAGE_IMAGE_TYPE', null, 'filesystems.images', 'local_secure');
19+
20+
putenv('STORAGE_TYPE=local');
1921
}
2022

2123
public function test_filesystem_attachments_falls_back_to_storage_type_var()
@@ -24,6 +26,8 @@ public function test_filesystem_attachments_falls_back_to_storage_type_var()
2426

2527
$this->checkEnvConfigResult('STORAGE_ATTACHMENT_TYPE', 's3', 'filesystems.attachments', 's3');
2628
$this->checkEnvConfigResult('STORAGE_ATTACHMENT_TYPE', null, 'filesystems.attachments', 'local_secure');
29+
30+
putenv('STORAGE_TYPE=local');
2731
}
2832

2933
public function test_app_url_blank_if_old_default_value()
@@ -45,10 +49,12 @@ public function test_app_url_blank_if_old_default_value()
4549
*/
4650
protected function checkEnvConfigResult(string $envName, $envVal, string $configKey, string $expectedResult)
4751
{
52+
$originalVal = getenv($envName);
4853
$envString = $envName . (is_null($envVal) ? '' : '=') . ($envVal ?? '');
4954
putenv($envString);
5055
$this->refreshApplication();
5156
$this->assertEquals($expectedResult, config($configKey));
57+
putenv($envString = $envName . (empty($originalVal) ? '' : '=') . ($originalVal ?? ''));
5258
}
5359

5460
}

0 commit comments

Comments
 (0)