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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
From 2aa9dc045d03c3cf55eefa769b4a54b20c41bc18 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 10 Apr 2020 15:49:35 +0200
Subject: split tests for PHP 7/8
---
package.xml | 4 +++-
tests/002-rpmvercmp.phpt | 13 -------------
tests/010-rpmvercmp_error7.phpt | 25 +++++++++++++++++++++++++
tests/011-rpmvercmp_error8.phpt | 31 +++++++++++++++++++++++++++++++
4 files changed, 59 insertions(+), 14 deletions(-)
create mode 100644 tests/010-rpmvercmp_error7.phpt
create mode 100644 tests/011-rpmvercmp_error8.phpt
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
--
cgit v1.1
From 895bc3dbd5dd48c97561bb0758f86a8c67bd6874 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 10 Apr 2020 15:53:11 +0200
Subject: fix test
---
tests/010-rpmvercmp_error7.phpt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/010-rpmvercmp_error7.phpt b/tests/010-rpmvercmp_error7.phpt
index 98bfeb3..c9b3875 100644
--- a/tests/010-rpmvercmp_error7.phpt
+++ b/tests/010-rpmvercmp_error7.phpt
@@ -14,12 +14,12 @@ var_dump(rpmvercmp("a", "b", "c"));
Done
--EXPECTF--
-Warning: rpmvercmp() expects exactly 2 parameters, 0 given in %s/002-rpmvercmp.php on line %d
+Warning: rpmvercmp() expects exactly 2 parameters, 0 given in %s
NULL
-Warning: rpmvercmp() expects exactly 2 parameters, 1 given in %s/002-rpmvercmp.php on line %d
+Warning: rpmvercmp() expects exactly 2 parameters, 1 given in %s
NULL
-Warning: rpmvercmp() expects exactly 2 parameters, 3 given in %s/002-rpmvercmp.php on line %d
+Warning: rpmvercmp() expects exactly 2 parameters, 3 given in %s
NULL
Done
--
cgit v1.1
|