summaryrefslogtreecommitdiffstats
path: root/tests/006-rpminfo-errors.phpt
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-01-30 17:36:04 +0100
committerRemi Collet <remi@remirepo.net>2018-01-30 17:36:04 +0100
commit47013783578b41a000b755e2726f057ecd4cd1cb (patch)
tree6a56d22ecf1e798c7889a6fc15eaf6bc005941e7 /tests/006-rpminfo-errors.phpt
parentcf809b71d4344aeb93378a577abc1ea18a3df323 (diff)
add option to retrieve error message instead of raising a warning
Diffstat (limited to 'tests/006-rpminfo-errors.phpt')
-rw-r--r--tests/006-rpminfo-errors.phpt36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/006-rpminfo-errors.phpt b/tests/006-rpminfo-errors.phpt
new file mode 100644
index 0000000..78ab21d
--- /dev/null
+++ b/tests/006-rpminfo-errors.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Check for rpminfo function errors
+--SKIPIF--
+<?php if (!extension_loaded("rpminfo")) print "skip"; ?>
+--FILE--
+<?php
+echo "+ PHP Warnings\n";
+var_dump(rpminfo(__DIR__ . "/missing.rpm"));
+var_dump(rpminfo(__FILE__));
+
+echo "\n+ PHP Warnings\n";
+var_dump(rpminfo(__DIR__ . "/missing.rpm", true, $error),
+ $error);
+var_dump(rpminfo(__FILE__, false, $error),
+ $error);
+var_dump(is_array(rpminfo(__DIR__ . "/bidon.rpm", false, $error)),
+ $error);
+?>
+Done
+--EXPECTF--
++ PHP Warnings
+
+Warning: rpminfo(): Can't open '%s/tests/missing.rpm': No such file or directory in %s on line %d
+bool(false)
+
+Warning: rpminfo(): Can't read '%s/tests/006-rpminfo-errors.php': Argument is not a RPM file in %s on line %d
+bool(false)
+
++ PHP Warnings
+bool(false)
+string(75) "Can't open '%s/tests/missing.rpm': No such file or directory"
+bool(false)
+string(87) "Can't read '%s/tests/006-rpminfo-errors.php': Argument is not a RPM file"
+bool(true)
+NULL
+Done