aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-12-05 15:28:33 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-12-11 12:02:12 +0100
commit5a03e0a5cf30f4ad5cecd7a90ad3bc2a004770aa (patch)
treee8429231ef714254ae135b4fb7dc3bb82e89ddfe /tests
parentee46548f57310b45ce723fd03ec29bfb686f8bc2 (diff)
downloadnextcloud-server-5a03e0a5cf30f4ad5cecd7a90ad3bc2a004770aa.tar.gz
nextcloud-server-5a03e0a5cf30f4ad5cecd7a90ad3bc2a004770aa.zip
adding dependency to owncloud version - with fallback to requiremin and requiremax
Diffstat (limited to 'tests')
-rw-r--r--tests/data/app/expected-info.json8
-rw-r--r--tests/data/app/valid-info.xml1
-rw-r--r--tests/lib/app/dependencyanalyzer.php32
3 files changed, 40 insertions, 1 deletions
diff --git a/tests/data/app/expected-info.json b/tests/data/app/expected-info.json
index b899df7a8d6..ab4f103939a 100644
--- a/tests/data/app/expected-info.json
+++ b/tests/data/app/expected-info.json
@@ -60,6 +60,12 @@
},
"curl"
],
- "os": "Linux"
+ "os": "Linux",
+ "owncloud": {
+ "@attributes" : {
+ "min-version": "7.01",
+ "max-version": "8"
+ }
+ }
}
}
diff --git a/tests/data/app/valid-info.xml b/tests/data/app/valid-info.xml
index 42f4e3edb7f..4b22d55d7bc 100644
--- a/tests/data/app/valid-info.xml
+++ b/tests/data/app/valid-info.xml
@@ -29,5 +29,6 @@
<lib max-version="2.0">intl</lib>
<lib>curl</lib>
<os>Linux</os>
+ <owncloud min-version="7.0.1" max-version="8" />
</dependencies>
</info>
diff --git a/tests/lib/app/dependencyanalyzer.php b/tests/lib/app/dependencyanalyzer.php
index 1cd24193ea6..9c5db96e045 100644
--- a/tests/lib/app/dependencyanalyzer.php
+++ b/tests/lib/app/dependencyanalyzer.php
@@ -51,6 +51,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
}
return null;
}));
+ $this->platformMock->expects($this->any())
+ ->method('getOcVersion')
+ ->will( $this->returnValue('8.0.1'));
$this->l10nMock = $this->getMockBuilder('\OCP\IL10N')
->disableOriginalConstructor()
@@ -161,6 +164,35 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
$this->assertEquals($expectedMissing, $missing);
}
+ /**
+ * @dataProvider providesOC
+ * @param $expectedMissing
+ * @param $oc
+ */
+ function testOC($expectedMissing, $oc) {
+ $app = array(
+ 'dependencies' => array()
+ );
+ if (!is_null($oc)) {
+ $app['dependencies']['oc'] = $oc;
+ }
+
+ $analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock);
+ $missing = $analyser->analyze();
+
+ $this->assertTrue(is_array($missing));
+ $this->assertEquals($expectedMissing, $missing);
+ }
+
+ function providesOC() {
+ return array(
+ // no version -> no missing dependency
+ array(array(), null),
+ array(array('ownCloud 9 or higher is required.'), array('@attributes' => array('min-version' => '9'))),
+ array(array('ownCloud with a version lower than 5.1.2 is required.'), array('@attributes' => array('max-version' => '5.1.2'))),
+ );
+ }
+
function providesOS() {
return array(
array(array(), null),