summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-03-11 16:29:52 +0100
committerRemi Collet <remi@remirepo.net>2020-03-11 16:29:52 +0100
commit9d455172490b3c768eda092e0898b666e17a23d2 (patch)
treea55f9125d009b5be6925b310ccb3663e6e5d7a22
parentdb270c6c4667957045127ad04af206ce48e9a5c8 (diff)
add simple test for glob/regex search
-rw-r--r--package.xml1
-rw-r--r--rpminfo.c2
-rw-r--r--tests/008-rpmdbinfo2.phpt16
3 files changed, 18 insertions, 1 deletions
diff --git a/package.xml b/package.xml
index b5c6e65..41ff33f 100644
--- a/package.xml
+++ b/package.xml
@@ -53,6 +53,7 @@ Available functions:
<file name="005-rpminfo-full.phpt" role="test"/>
<file name="006-rpminfo-errors.phpt" role="test"/>
<file name="007-rpmdbinfo.phpt" role="test"/>
+ <file name="008-rpmdbinfo2.phpt" role="test"/>
<file name="bidon.rpm" role="test"/>
<file name="bidon-src.rpm" role="test"/>
</dir>
diff --git a/rpminfo.c b/rpminfo.c
index fdf9d93..f20d605 100644
--- a/rpminfo.c
+++ b/rpminfo.c
@@ -275,7 +275,7 @@ PHP_FUNCTION(rpmdbinfo)
di = rpmdbInitIterator(db, RPMTAG_NAME, name, len);
}
if (!di) {
- php_error_docref(NULL, E_WARNING, "Can't open rpmdb");
+ // Not found
rpmtsCloseDB(ts);
RETURN_FALSE;
}
diff --git a/tests/008-rpmdbinfo2.phpt b/tests/008-rpmdbinfo2.phpt
new file mode 100644
index 0000000..940ad61
--- /dev/null
+++ b/tests/008-rpmdbinfo2.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Check for rpmdbinfo function
+--SKIPIF--
+<?php if (!extension_loaded("rpminfo")) print "skip"; ?>
+--FILE--
+<?php
+$a = rpmdbinfo('php*', false, RPM_MATCH_GLOB);
+var_dump(count($a) > 1);
+$a = rpmdbinfo('^php', false, RPM_MATCH_REGEX);
+var_dump(count($a) > 1);
+?>
+Done
+--EXPECTF--
+bool(true)
+bool(true)
+Done