summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/003-rpminfo.phpt9
-rw-r--r--tests/006-rpminfo-errors.phpt36
2 files changed, 36 insertions, 9 deletions
diff --git a/tests/003-rpminfo.phpt b/tests/003-rpminfo.phpt
index f7cee82..f878c7f 100644
--- a/tests/003-rpminfo.phpt
+++ b/tests/003-rpminfo.phpt
@@ -5,9 +5,6 @@ Check for rpminfo function
--FILE--
<?php
var_dump(rpminfo(__DIR__ . "/bidon.rpm"));
-// Errors
-var_dump(rpminfo(__DIR__ . "/missing.rpm"));
-var_dump(rpminfo(__FILE__));
?>
Done
--EXPECTF--
@@ -21,10 +18,4 @@ array(4) {
["Arch"]=>
string(6) "x86_64"
}
-
-Warning: rpminfo(): Can't open '%s/tests/missing.rpm': No such file or directory in %s/003-rpminfo.php on line %d
-bool(false)
-
-Warning: rpminfo(): Can't read '%s/tests/003-rpminfo.php': Argument is not a RPM file in %s/003-rpminfo.php on line %d
-bool(false)
Done
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