diff options
-rw-r--r-- | tests/unit/utility/ConfigTest.php | 17 | ||||
-rw-r--r-- | utility/config.php | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/unit/utility/ConfigTest.php b/tests/unit/utility/ConfigTest.php index 455abf810..479acabb5 100644 --- a/tests/unit/utility/ConfigTest.php +++ b/tests/unit/utility/ConfigTest.php @@ -66,8 +66,21 @@ class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $this->config->read($this->configPath); - $this->assertEquals(3, $this->config->getAutoPurgeCount()); - $this->assertEquals(true, $this->config->getUseCronUpdates()); + $this->assertTrue(3 === $this->config->getAutoPurgeCount()); + $this->assertTrue(true === $this->config->getUseCronUpdates()); + } + + + public function testReadBool () { + $this->fileSystem->expects($this->once()) + ->method('file_get_contents') + ->with($this->equalTo($this->configPath)) + ->will($this->returnValue("autoPurgeCount = 3\nuseCronUpdates = false")); + + $this->config->read($this->configPath); + + $this->assertTrue(3 === $this->config->getAutoPurgeCount()); + $this->assertTrue(false === $this->config->getUseCronUpdates()); } diff --git a/utility/config.php b/utility/config.php index 7841b3f5f..54145c993 100644 --- a/utility/config.php +++ b/utility/config.php @@ -119,6 +119,8 @@ class Config { foreach($configValues as $key => $value) { if(property_exists($this, $key)) { + $type = gettype($this->$key); + settype($value, $type); $this->$key = $value; } else { $this->api->log('Configuration value "' . $key . |