+
+ /**
+ * Test that using a wrong configuration directory leads to the "normal" config path
+ */
+ public function testWrongEnvDir()
+ {
+ $this->delConfigFile('local.config.php');
+
+ $configFileLoader = new ConfigFileLoader($this->root->url(), ['FRIENDICA_CONFIG_DIR' => '/a/wrong/dir/']);
+ $configCache = new Cache();
+
+ $configFileLoader->setupCache($configCache);
+
+ self::assertEquals($this->root->url(), $configCache->get('system', 'basepath'));
+ }
+
+ /**
+ * Test that a different location of the configuration directory produces the expected output
+ */
+ public function testRightEnvDir()
+ {
+ $this->delConfigFile('local.config.php');
+
+ $fileDir = dirname(__DIR__) . DIRECTORY_SEPARATOR .
+ '..' . DIRECTORY_SEPARATOR .
+ '..' . DIRECTORY_SEPARATOR .
+ 'datasets' . DIRECTORY_SEPARATOR .
+ 'config' . DIRECTORY_SEPARATOR;
+
+ vfsStream::newFile('B.config.php')
+ ->at($this->root->getChild('config2'))
+ ->setContent(file_get_contents($fileDir . 'B.config.php'));
+
+ $configFileLoader = new ConfigFileLoader($this->root->url(), ['FRIENDICA_CONFIG_DIR' => $this->root->getChild('config2')->url()]);
+ $configCache = new Cache();
+
+ $configFileLoader->setupCache($configCache);
+
+ self::assertEquals('newValue', $configCache->get('system', 'newKey'));
+ }