diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-13 10:51:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 10:51:09 +0200 |
commit | 01f3698175694d9994c8ef0bb91745582edf3345 (patch) | |
tree | ceab09f088061b226f019a48822f6f03d2eb3005 /tests | |
parent | 7cb6038fca25b925b76a537a84d1e447bcc3ba1f (diff) | |
parent | 95a21e2f2a7515be1d91d3f70db9cf821f872294 (diff) | |
download | nextcloud-server-01f3698175694d9994c8ef0bb91745582edf3345.tar.gz nextcloud-server-01f3698175694d9994c8ef0bb91745582edf3345.zip |
Merge pull request #3966 from nextcloud/downstream-26570
Override config.php values through environment variables
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/ConfigTest.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index 74dcdc192ce..2a4c9620340 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -48,6 +48,27 @@ class ConfigTest extends TestCase { $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers')); } + public function testGetValueReturnsEnvironmentValueIfSet() { + $this->assertEquals('bar', $this->config->getValue('foo')); + putenv('NC_foo=baz'); + $this->assertEquals('baz', $this->config->getValue('foo')); + putenv('NC_foo'); // unset the env variable + } + + public function testGetValueReturnsEnvironmentValueIfSetToZero() { + $this->assertEquals('bar', $this->config->getValue('foo')); + putenv('NC_foo=0'); + $this->assertEquals('0', $this->config->getValue('foo')); + putenv('NC_foo'); // unset the env variable + } + + public function testGetValueReturnsEnvironmentValueIfSetToFalse() { + $this->assertEquals('bar', $this->config->getValue('foo')); + putenv('NC_foo=false'); + $this->assertEquals('false', $this->config->getValue('foo')); + putenv('NC_foo'); // unset the env variable + } + public function testSetValue() { $this->config->setValue('foo', 'moo'); $expectedConfig = $this->initialConfig; |