diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-09-08 15:05:57 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-09-18 13:33:13 +0200 |
commit | 23dd7cb51d392d2d6fb82b55c5f51a6bf6e93733 (patch) | |
tree | eb3d490458402de53f95dce643faca01c5c16038 /tests/lib/utilcheckserver.php | |
parent | 6fa3280c2a4033e99b867440ae49932390784c48 (diff) | |
download | nextcloud-server-23dd7cb51d392d2d6fb82b55c5f51a6bf6e93733.tar.gz nextcloud-server-23dd7cb51d392d2d6fb82b55c5f51a6bf6e93733.zip |
Don't complain about non-writable datadirs before we're installed
Diffstat (limited to 'tests/lib/utilcheckserver.php')
-rw-r--r-- | tests/lib/utilcheckserver.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/lib/utilcheckserver.php b/tests/lib/utilcheckserver.php index 78888bd909d..be5596c1900 100644 --- a/tests/lib/utilcheckserver.php +++ b/tests/lib/utilcheckserver.php @@ -19,6 +19,7 @@ class Test_Util_CheckServer extends PHPUnit_Framework_TestCase { */ protected function getConfig($systemOptions) { $systemOptions['datadirectory'] = $this->datadir; + $systemOptions['appstoreenabled'] = false; //it's likely that there is no app folder we can write in $config = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor() ->getMock(); @@ -35,6 +36,7 @@ class Test_Util_CheckServer extends PHPUnit_Framework_TestCase { $this->datadir = \OC_Helper::tmpFolder(); file_put_contents($this->datadir . '/.ocdata', ''); + \OC::$server->getSession()->set('checkServer_succeeded', false); } public function tearDown() { @@ -121,4 +123,39 @@ class Test_Util_CheckServer extends PHPUnit_Framework_TestCase { $this->assertCount(1, $result); } + /** + * Tests that no error is given when the datadir is writable + */ + public function testDataDirWritable() { + $result = \OC_Util::checkServer($this->getConfig(array( + 'installed' => true, + 'version' => implode('.', OC_Util::getVersion()) + ))); + $this->assertEmpty($result); + } + + /** + * Tests an error is given when the datadir is not writable + */ + public function testDataDirNotWritable() { + chmod($this->datadir, 0300); + $result = \OC_Util::checkServer($this->getConfig(array( + 'installed' => true, + 'version' => implode('.', OC_Util::getVersion()) + ))); + $this->assertCount(1, $result); + } + + /** + * Tests no error is given when the datadir is not writable during setup + */ + public function testDataDirNotWritableSetup() { + chmod($this->datadir, 0300); + $result = \OC_Util::checkServer($this->getConfig(array( + 'installed' => false, + 'version' => implode('.', OC_Util::getVersion()) + ))); + chmod($this->datadir, 0700); //needed for cleanup + $this->assertEmpty($result); + } } |