summaryrefslogtreecommitdiffstats
path: root/tests/008-rpmdbsearch.phpt
blob: f348b923fb02c5161829fa7d8c38210ac2c41fa4 (plain)
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
--TEST--
Check for rpmdbinfo function
--SKIPIF--
<?php if (!extension_loaded("rpminfo")) print "skip"; ?>
--FILE--
<?php 
echo "Name / glob\n";
$a = rpmdbsearch('php*', RPMTAG_NAME , RPMMIRE_GLOB);
var_dump(count($a) > 1);

echo "Name / regex\n";
$a = rpmdbsearch('^php', RPMTAG_NAME, RPMMIRE_REGEX);
var_dump(count($a) > 1);

echo "Installed file\n";
$a = rpmdbsearch(PHP_BINARY, RPMTAG_INSTFILENAMES);
var_dump(count($a) == 1);

$phprpm = $a[0]['Name'];
$p = rpmdbinfo($phprpm, 1);

echo "Pkgid\n";
$a = rpmdbsearch($p[0]['Sigmd5'], RPMTAG_PKGID);
var_dump($a[0]['Name'] == $phprpm);

echo "Hdrid\n";
$a = rpmdbsearch($p[0]['Sha1header'], RPMTAG_HDRID);
var_dump($a[0]['Name'] == $phprpm);
var_dump(count($a[0]) < 10);

echo "Hdrid (full)\n";
$a = rpmdbsearch($p[0]['Sha1header'], RPMTAG_HDRID, -1, true);
var_dump($a[0]['Name'] == $phprpm);
var_dump($a[0]['Sha1header'] == $p[0]['Sha1header']);
var_dump(count($a[0]) > 20);

echo "Installtid\n";
$a = rpmdbsearch($p[0]['Installtid'], RPMTAG_INSTALLTID);
var_dump(count($a) >= 1);

echo "Version\n";
$a = rpmdbsearch($p[0]['Version'], RPMTAG_VERSION);
var_dump(count($a) > 1);

?>
Done
--EXPECTF--
Name / glob
bool(true)
Name / regex
bool(true)
Installed file
bool(true)
Pkgid
bool(true)
Hdrid
bool(true)
bool(true)
Hdrid (full)
bool(true)
bool(true)
bool(true)
Installtid
bool(true)
Version
bool(true)
Done