1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
--TEST--
PEAR_Common::sortPkgDeps test
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
echo 'skip';
}
?>
--FILE--
<?php
$dir = getcwd();
chdir(dirname(__FILE__));
require_once 'PEAR/Common.php';
$c = new PEAR_Common();
$packages = array(
'common_sortPkgDeps6_package.xml',
'common_sortPkgDeps2_package.xml',
'common_sortPkgDeps1_package.xml',
'common_sortPkgDeps4_package.xml',
'common_sortPkgDeps5_package.xml',
'common_sortPkgDeps3_package.xml',
);
$uninstallpackages = array(
$c->infoFromAny('common_sortPkgDeps6_package.xml'),
$c->infoFromAny('common_sortPkgDeps2_package.xml'),
$c->infoFromAny('common_sortPkgDeps1_package.xml'),
$c->infoFromAny('common_sortPkgDeps4_package.xml'),
$c->infoFromAny('common_sortPkgDeps5_package.xml'),
$c->infoFromAny('common_sortPkgDeps3_package.xml'),
);
echo "Test Install Sort:\n";
$c->sortPkgDeps($packages);
dumpPacks($packages);
echo "Test Uninstall Sort:\n";
$c->sortPkgDeps($uninstallpackages, true);
dumpPacks($uninstallpackages);
chdir($dir);
function dumpPacks($p)
{
echo "Packages(\n";
foreach ($p as $inf) {
echo $inf['info']['package'] . ",\n";
}
echo ")\n";
}
?>
--EXPECT--
Test Install Sort:
Packages(
pkg6,
pkg5,
pkg4,
pkg3,
pkg2,
pkg1,
)
Test Uninstall Sort:
Packages(
pkg1,
pkg2,
pkg3,
pkg5,
pkg4,
pkg6,
)
|