]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix failing master branch - Test_Config::testWriteData
authorMorris Jobke <morris.jobke@gmail.com>
Sun, 21 Jul 2013 09:13:29 +0000 (11:13 +0200)
committerMorris Jobke <morris.jobke@gmail.com>
Sun, 21 Jul 2013 09:13:29 +0000 (11:13 +0200)
lib/config.php
tests/lib/config.php

index 00d9f5b4247e80fc47af09e8a4b34363cb820c61..a38ce19c74f1ce9731b2af7362864dffe5836739 100644 (file)
@@ -144,7 +144,11 @@ class Config {
                                continue;
                        }
                        unset($CONFIG);
-                       include $file;
+                       if((@include $file) === false)
+                       {
+                               throw new HintException("Can't read from config file '" . $file . "'. ".
+                                       'This is usually caused by the wrong file permission.');
+                       }
                        if (isset($CONFIG) && is_array($CONFIG)) {
                                $this->cache = array_merge($this->cache, $CONFIG);
                        }
index c67a66c832e4afd1fd96a3e69e87d7707e515275..1a1d062d6882626154f81c47c8540580425505fb 100644 (file)
@@ -80,6 +80,17 @@ class Test_Config extends PHPUnit_Framework_TestCase {
         */
        public function testWriteData() {
                $config = new OC\Config('/non-writable');
+               // TODO never get's called, because the previous call throws the exception
+               // maybe include some more logic to create a readable dir and then try to
+               // write to this dir
+               //
+               // console commands:
+               // $ sudo touch /non-writableconfig.php
+               // $ sudo chmod go-rwx /non-writableconfig.php
+               // ---- call the tests now -> above statemant throws the exception
+               //
+               // $ sudo chmod go+r /non-writableconfig.php
+               // ---- call the tests now -> bellow statemant throws the exception
                $config->setValue('foo', 'bar');
        }
 }