adding dependencies for supported platforms
This commit is contained in:
parent
770f987659
commit
ee46548f57
|
@ -48,6 +48,7 @@ class DependencyAnalyzer {
|
|||
$this->analyzeDatabases();
|
||||
$this->analyzeCommands();
|
||||
$this->analyzeLibraries();
|
||||
$this->analyzeOS();
|
||||
return $this->missing;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
* @return mixed
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
"@value": "intl"
|
||||
},
|
||||
"curl"
|
||||
]
|
||||
],
|
||||
"os": "Linux"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,5 +28,6 @@
|
|||
<lib min-version="1.2">xml</lib>
|
||||
<lib max-version="2.0">intl</lib>
|
||||
<lib>curl</lib>
|
||||
<os>Linux</os>
|
||||
</dependencies>
|
||||
</info>
|
||||
|
|
|
@ -141,6 +141,34 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
|
|||
$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() {
|
||||
return array(
|
||||
// we expect curl to exist
|
||||
|
|
Loading…
Reference in New Issue