summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/appconfig.php21
-rw-r--r--tests/unit/config/AppConfigTest.php15
2 files changed, 29 insertions, 7 deletions
diff --git a/config/appconfig.php b/config/appconfig.php
index 1a2367c4b..44932f693 100644
--- a/config/appconfig.php
+++ b/config/appconfig.php
@@ -161,12 +161,22 @@ class AppConfig {
* @throws \OCA\News\DependencyException if one version is not satisfied
*/
public function testDependencies() {
+ $msg = '';
+
+ // test databases
+ if(array_key_exists('databases', $this->config)) {
+ if(!in_array($this->databaseType, $this->config['databases'])) {
+ $msg .= 'Database ' . $this->databaseType . ' not supported.' .
+ 'App is only compatible with ' .
+ implode(', ', $this->config['databases']);
+ }
+ }
+
+ // test dependencies
if(array_key_exists('dependencies', $this->config)) {
$deps = $this->config['dependencies'];
- $msg = '';
-
if(array_key_exists('php', $deps)) {
$msg .= $this->requireVersion($this->phpVersion, $deps['php'],
'PHP');
@@ -198,11 +208,10 @@ class AppConfig {
}
}
}
+ }
- if($msg !== '') {
- throw new DependencyException($msg);
- }
-
+ if($msg !== '') {
+ throw new DependencyException($msg);
}
}
diff --git a/tests/unit/config/AppConfigTest.php b/tests/unit/config/AppConfigTest.php
index 7ee533e8b..8f91dd338 100644
--- a/tests/unit/config/AppConfigTest.php
+++ b/tests/unit/config/AppConfigTest.php
@@ -42,7 +42,7 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
$installedExtensions = array(
'curl' => '4.3'
);
- $databaseType = 'postgresql';
+ $databaseType = 'oracle';
$this->config = new AppConfig($this->nav, $this->l10n,
$this->url, $phpVersion, $ownCloudVersion, $installedApps,
@@ -228,4 +228,17 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
));
$this->config->testDependencies();
}
+
+
+ /**
+ * @expectedException \OCA\News\Config\DependencyException
+ */
+ public function testSupportedDb() {
+ $this->config->loadConfig(array(
+ 'databases' => array(
+ 'pgsql', 'sqlite'
+ )
+ ));
+ $this->config->testDependencies();
+ }
} \ No newline at end of file