summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-09-02 03:19:42 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-09-02 03:19:42 +0200
commitb512f045446942f802740764d5b4178c97205a37 (patch)
tree4562f14d5a1b21df33a18e402706611187546238 /tests
parent38297af11f458b30af3cbdc42cf3407d6aff44ab (diff)
switch from json config to ini config
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/utility/ConfigTest.php39
1 files changed, 19 insertions, 20 deletions
diff --git a/tests/unit/utility/ConfigTest.php b/tests/unit/utility/ConfigTest.php
index 849fe37fd..455abf810 100644
--- a/tests/unit/utility/ConfigTest.php
+++ b/tests/unit/utility/ConfigTest.php
@@ -62,11 +62,12 @@ class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileSystem->expects($this->once())
->method('file_get_contents')
->with($this->equalTo($this->configPath))
- ->will($this->returnValue('{"autoPurgeCount": 3}'));
+ ->will($this->returnValue("autoPurgeCount = 3\nuseCronUpdates = true"));
$this->config->read($this->configPath);
$this->assertEquals(3, $this->config->getAutoPurgeCount());
+ $this->assertEquals(true, $this->config->getUseCronUpdates());
}
@@ -74,7 +75,7 @@ class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
$this->fileSystem->expects($this->once())
->method('file_get_contents')
->with($this->equalTo($this->configPath))
- ->will($this->returnValue('{"autoPurgeCounts": 3}'));
+ ->will($this->returnValue('autoPurgeCounts = 3'));
$this->api->expects($this->once())
->method('log')
->with($this->equalTo('Configuration value "autoPurgeCounts" ' .
@@ -85,14 +86,14 @@ class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
}
- public function testReadLogsInvalidJSON() {
+ public function testReadLogsInvalidINI() {
$this->fileSystem->expects($this->once())
->method('file_get_contents')
->with($this->equalTo($this->configPath))
- ->will($this->returnValue(null));
+ ->will($this->returnValue(''));
$this->api->expects($this->once())
->method('log')
- ->with($this->equalTo('Configuration contains invalid JSON'),
+ ->with($this->equalTo('Configuration invalid. Ignoring values.'),
$this->equalTo('warn'));
$this->config->read($this->configPath);
@@ -100,13 +101,11 @@ class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
public function testWrite () {
- $json = "{\n" .
- " \"autoPurgeMinimumInterval\": 60,\n" .
- " \"autoPurgeCount\": 3,\n" .
- " \"simplePieCacheDuration\": 1800,\n" .
- " \"feedFetcherTimeout\": 60,\n" .
- " \"useCronUpdates\": true\n" .
- "}";
+ $json = "autoPurgeMinimumInterval = 60\n" .
+ "autoPurgeCount = 3\n" .
+ "simplePieCacheDuration = 1800\n" .
+ "feedFetcherTimeout = 60\n" .
+ "useCronUpdates = true";
$this->config->setAutoPurgeCount(3);
$this->fileSystem->expects($this->once())
@@ -123,14 +122,14 @@ class ConfigFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
->method('file_exists')
->with($this->equalTo($this->configPath))
->will($this->returnValue(false));
-
- $json = "{\n" .
- " \"autoPurgeMinimumInterval\": 60,\n" .
- " \"autoPurgeCount\": 200,\n" .
- " \"simplePieCacheDuration\": 1800,\n" .
- " \"feedFetcherTimeout\": 60,\n" .
- " \"useCronUpdates\": true\n" .
- "}";
+
+ $this->config->setUseCronUpdates(false);
+
+ $json = "autoPurgeMinimumInterval = 60\n" .
+ "autoPurgeCount = 200\n" .
+ "simplePieCacheDuration = 1800\n" .
+ "feedFetcherTimeout = 60\n" .
+ "useCronUpdates = false";
$this->fileSystem->expects($this->once())
->method('file_put_contents')