Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
b21d4a55
Commit
b21d4a55
authored
9 years ago
by
Lukas Reschke
Browse files
Options
Downloads
Patches
Plain Diff
Add missing type annotations
parent
063071b5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/app/dependencyanalyzer.php
+37
-10
37 additions, 10 deletions
lib/private/app/dependencyanalyzer.php
tests/lib/app/dependencyanalyzer.php
+25
-0
25 additions, 0 deletions
tests/lib/app/dependencyanalyzer.php
with
62 additions
and
10 deletions
lib/private/app/dependencyanalyzer.php
+
37
−
10
View file @
b21d4a55
...
...
@@ -30,9 +30,10 @@ class DependencyAnalyzer {
/** @var Platform */
private
$platform
;
/** @var \OCP\IL10N */
private
$l
;
/** @var array */
private
$appInfo
;
/**
* @param Platform $platform
...
...
@@ -47,7 +48,7 @@ class DependencyAnalyzer {
* @param array $app
* @returns array of missing dependencies
*/
public
function
analyze
(
$app
)
{
public
function
analyze
(
array
$app
)
{
$this
->
appInfo
=
$app
;
if
(
isset
(
$app
[
'dependencies'
]))
{
$dependencies
=
$app
[
'dependencies'
];
...
...
@@ -61,11 +62,12 @@ class DependencyAnalyzer {
$this
->
analyzeCommands
(
$dependencies
),
$this
->
analyzeLibraries
(
$dependencies
),
$this
->
analyzeOS
(
$dependencies
),
$this
->
analyzeOC
(
$dependencies
,
$app
));
$this
->
analyzeOC
(
$dependencies
,
$app
)
);
}
/**
* Truncates both verions to the lowest common version, e.g.
* Truncates both ver
s
ions to the lowest common version, e.g.
* 5.1.2.3 and 5.1 will be turned into 5.1 and 5.1,
* 5.2.6.5 and 5.1 will be turned into 5.2 and 5.1
* @param string $first
...
...
@@ -124,7 +126,11 @@ class DependencyAnalyzer {
return
$this
->
compare
(
$first
,
$second
,
'<'
);
}
private
function
analyzePhpVersion
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzePhpVersion
(
array
$dependencies
)
{
$missing
=
[];
if
(
isset
(
$dependencies
[
'php'
][
'@attributes'
][
'min-version'
]))
{
$minVersion
=
$dependencies
[
'php'
][
'@attributes'
][
'min-version'
];
...
...
@@ -141,7 +147,11 @@ class DependencyAnalyzer {
return
$missing
;
}
private
function
analyzeDatabases
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeDatabases
(
array
$dependencies
)
{
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'database'
]))
{
return
$missing
;
...
...
@@ -164,7 +174,11 @@ class DependencyAnalyzer {
return
$missing
;
}
private
function
analyzeCommands
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeCommands
(
array
$dependencies
)
{
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'command'
]))
{
return
$missing
;
...
...
@@ -187,7 +201,11 @@ class DependencyAnalyzer {
return
$missing
;
}
private
function
analyzeLibraries
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeLibraries
(
array
$dependencies
)
{
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'lib'
]))
{
return
$missing
;
...
...
@@ -225,7 +243,11 @@ class DependencyAnalyzer {
return
$missing
;
}
private
function
analyzeOS
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeOS
(
array
$dependencies
)
{
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'os'
]))
{
return
$missing
;
...
...
@@ -249,7 +271,12 @@ class DependencyAnalyzer {
return
$missing
;
}
private
function
analyzeOC
(
$dependencies
,
$appInfo
)
{
/**
* @param array $dependencies
* @param array $appInfo
* @return array
*/
private
function
analyzeOC
(
array
$dependencies
,
array
$appInfo
)
{
$missing
=
[];
$minVersion
=
null
;
if
(
isset
(
$dependencies
[
'owncloud'
][
'@attributes'
][
'min-version'
]))
{
...
...
This diff is collapsed.
Click to expand it.
tests/lib/app/dependencyanalyzer.php
+
25
−
0
View file @
b21d4a55
...
...
@@ -68,6 +68,10 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider providesPhpVersion
*
* @param string $expectedMissing
* @param string $minVersion
* @param string $maxVersion
*/
public
function
testPhpVersion
(
$expectedMissing
,
$minVersion
,
$maxVersion
)
{
$app
=
array
(
...
...
@@ -106,6 +110,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider providesCommands
*
* @param string $expectedMissing
* @param string|null $commands
*/
public
function
testCommand
(
$expectedMissing
,
$commands
)
{
$app
=
array
(
...
...
@@ -179,6 +186,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
$expectedMissing
,
$missing
);
}
/**
* @return array
*/
function
providesOC
()
{
return
array
(
// no version -> no missing dependency
...
...
@@ -192,6 +202,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
}
/**
* @return array
*/
function
providesOS
()
{
return
array
(
array
(
array
(),
null
),
...
...
@@ -201,6 +214,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
}
/**
* @return array
*/
function
providesLibs
()
{
return
array
(
// we expect curl to exist
...
...
@@ -226,6 +242,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
}
/**
* @return array
*/
function
providesCommands
()
{
return
array
(
array
(
array
(),
null
),
...
...
@@ -240,6 +259,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
}
/**
* @return array
*/
function
providesDatabases
()
{
return
array
(
// non BC - in case on databases are defined -> all are supported
...
...
@@ -250,6 +272,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
}
/**
* @return array
*/
function
providesPhpVersion
()
{
return
array
(
array
(
array
(),
null
,
null
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment