Skip to content
Snippets Groups Projects
Commit ee46548f authored by Thomas Müller's avatar Thomas Müller
Browse files

adding dependencies for supported platforms

parent 770f9876
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,7 @@ class DependencyAnalyzer { ...@@ -48,6 +48,7 @@ class DependencyAnalyzer {
$this->analyzeDatabases(); $this->analyzeDatabases();
$this->analyzeCommands(); $this->analyzeCommands();
$this->analyzeLibraries(); $this->analyzeLibraries();
$this->analyzeOS();
return $this->missing; return $this->missing;
} }
...@@ -135,6 +136,26 @@ class DependencyAnalyzer { ...@@ -135,6 +136,26 @@ class DependencyAnalyzer {
} }
} }
private function analyzeOS() {
if (!isset($this->dependencies['os'])) {
return;
}
$oss = $this->dependencies['os'];
if (empty($oss)) {
return;
}
$oss = array_map(function($os) {
return $this->getValue($os);
}, $oss);
$currentOS = $this->platform->getOS();
if (!in_array($currentOS, $oss)) {
$this->addMissing((string)$this->l->t('Following platforms are supported: %s', join(', ', $oss)));
}
}
/** /**
* @param $element * @param $element
* @return mixed * @return mixed
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
"@value": "intl" "@value": "intl"
}, },
"curl" "curl"
] ],
"os": "Linux"
} }
} }
...@@ -28,5 +28,6 @@ ...@@ -28,5 +28,6 @@
<lib min-version="1.2">xml</lib> <lib min-version="1.2">xml</lib>
<lib max-version="2.0">intl</lib> <lib max-version="2.0">intl</lib>
<lib>curl</lib> <lib>curl</lib>
<os>Linux</os>
</dependencies> </dependencies>
</info> </info>
...@@ -141,6 +141,34 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase { ...@@ -141,6 +141,34 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
$this->assertEquals($expectedMissing, $missing); $this->assertEquals($expectedMissing, $missing);
} }
/**
* @dataProvider providesOS
* @param $expectedMissing
* @param $oss
*/
function testOS($expectedMissing, $oss) {
$app = array(
'dependencies' => array()
);
if (!is_null($oss)) {
$app['dependencies']['os'] = $oss;
}
$analyser = new \OC\App\DependencyAnalyzer($app, $this->platformMock, $this->l10nMock);
$missing = $analyser->analyze();
$this->assertTrue(is_array($missing));
$this->assertEquals($expectedMissing, $missing);
}
function providesOS() {
return array(
array(array(), null),
array(array(), array()),
array(array('Following platforms are supported: WINNT'), array('WINNT'))
);
}
function providesLibs() { function providesLibs() {
return array( return array(
// we expect curl to exist // we expect curl to exist
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment