summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-04-10 15:49:35 +0200
committerRemi Collet <remi@remirepo.net>2020-04-10 15:49:35 +0200
commit2aa9dc045d03c3cf55eefa769b4a54b20c41bc18 (patch)
treec636604b8d7c3d39a1495e1eb9fe7ef365f577b8
parentd1b0b95a90a5f611ea19433ff1867fa8a88adc7f (diff)
split tests for PHP 7/8
-rw-r--r--package.xml4
-rw-r--r--tests/002-rpmvercmp.phpt13
-rw-r--r--tests/010-rpmvercmp_error7.phpt25
-rw-r--r--tests/011-rpmvercmp_error8.phpt31
4 files changed, 59 insertions, 14 deletions
diff --git a/package.xml b/package.xml
index 714c9f9..237bd54 100644
--- a/package.xml
+++ b/package.xml
@@ -24,7 +24,7 @@ Documentation: https://www.php.net/rpminfo
</stability>
<license>PHP 3.01</license>
<notes>
--
+- split tests for PHP 7/8
</notes>
<contents>
<dir name="/">
@@ -51,6 +51,8 @@ Documentation: https://www.php.net/rpminfo
<file name="007-rpmdbinfo.phpt" role="test"/>
<file name="008-rpmdbsearch.phpt" role="test"/>
<file name="009-rpmdbinfo2.phpt" role="test"/>
+ <file name="010-rpmvercmp_error7.phpt" role="test"/>
+ <file name="011-rpmvercmp_error8.phpt" role="test"/>
<file name="bidon.rpm" role="test"/>
<file name="bidon-src.rpm" role="test"/>
</dir>
diff --git a/tests/002-rpmvercmp.phpt b/tests/002-rpmvercmp.phpt
index 7da40b4..d83cf67 100644
--- a/tests/002-rpmvercmp.phpt
+++ b/tests/002-rpmvercmp.phpt
@@ -35,21 +35,8 @@ foreach ($cases as $case) {
}
}
if ($ok) echo "OK\n";
-// Errors
-var_dump(rpmvercmp());
-var_dump(rpmvercmp("a"));
-var_dump(rpmvercmp("a", "b", "c"));
?>
Done
--EXPECTF--
OK
-
-Warning: rpmvercmp() expects exactly 2 parameters, 0 given in %s/002-rpmvercmp.php on line %d
-NULL
-
-Warning: rpmvercmp() expects exactly 2 parameters, 1 given in %s/002-rpmvercmp.php on line %d
-NULL
-
-Warning: rpmvercmp() expects exactly 2 parameters, 3 given in %s/002-rpmvercmp.php on line %d
-NULL
Done
diff --git a/tests/010-rpmvercmp_error7.phpt b/tests/010-rpmvercmp_error7.phpt
new file mode 100644
index 0000000..98bfeb3
--- /dev/null
+++ b/tests/010-rpmvercmp_error7.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Check for rpmvercmp function error
+--SKIPIF--
+<?php
+if (!extension_loaded("rpminfo")) print "skip";
+if (PHP_VERSION_ID >= 80000) print "skip only for PHP 7";
+?>
+--FILE--
+<?php
+var_dump(rpmvercmp());
+var_dump(rpmvercmp("a"));
+var_dump(rpmvercmp("a", "b", "c"));
+?>
+Done
+--EXPECTF--
+
+Warning: rpmvercmp() expects exactly 2 parameters, 0 given in %s/002-rpmvercmp.php on line %d
+NULL
+
+Warning: rpmvercmp() expects exactly 2 parameters, 1 given in %s/002-rpmvercmp.php on line %d
+NULL
+
+Warning: rpmvercmp() expects exactly 2 parameters, 3 given in %s/002-rpmvercmp.php on line %d
+NULL
+Done
diff --git a/tests/011-rpmvercmp_error8.phpt b/tests/011-rpmvercmp_error8.phpt
new file mode 100644
index 0000000..3db3564
--- /dev/null
+++ b/tests/011-rpmvercmp_error8.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Check for rpmvercmp function
+--SKIPIF--
+<?php
+if (!extension_loaded("rpminfo")) print "skip";
+if (PHP_VERSION_ID < 80000) print "skip only for PHP 8";
+?>
+--FILE--
+<?php
+try {
+ var_dump(rpmvercmp());
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(rpmvercmp("a"));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(rpmvercmp("a", "b", "c"));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+Done
+--EXPECTF--
+rpmvercmp() expects exactly 2 parameters, 0 given
+rpmvercmp() expects exactly 2 parameters, 1 given
+rpmvercmp() expects exactly 2 parameters, 3 given
+Done