File: 0003-split-test.patch

package info (click to toggle)
php-amqp 1.10.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,816 kB
  • sloc: ansic: 5,876; xml: 1,064; php: 582; pascal: 49; makefile: 2
file content (96 lines) | stat: -rw-r--r-- 2,570 bytes parent folder | download
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
From: Remi Collet <remi@remirepo.net>
Date: Mon, 31 Aug 2020 16:10:37 +0200
Subject: split test

---
 amqp-1.10.2/tests/amqptimestamp.phpt      |  4 +--
 amqp-1.10.2/tests/amqptimestamp_php8.phpt | 60 +++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 2 deletions(-)
 create mode 100644 amqp-1.10.2/tests/amqptimestamp_php8.phpt

diff --git a/amqp-1.10.2/tests/amqptimestamp.phpt b/amqp-1.10.2/tests/amqptimestamp.phpt
index 9835883..6424f8b 100644
--- a/amqp-1.10.2/tests/amqptimestamp.phpt
+++ b/amqp-1.10.2/tests/amqptimestamp.phpt
@@ -2,7 +2,7 @@
 AMQPTimestamp
 --SKIPIF--
 <?php
-if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<')) {
+if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '5.3', '<') || version_compare(PHP_VERSION, '8.0', '>')) {
   print "skip";
 }
 --FILE--
@@ -52,4 +52,4 @@ bool(true)
 string(20) "18446744073709551616"
 string(1) "0"
 
-==END==
\ No newline at end of file
+==END==
diff --git a/amqp-1.10.2/tests/amqptimestamp_php8.phpt b/amqp-1.10.2/tests/amqptimestamp_php8.phpt
new file mode 100644
index 0000000..dabecc5
--- /dev/null
+++ b/amqp-1.10.2/tests/amqptimestamp_php8.phpt
@@ -0,0 +1,60 @@
+--TEST--
+AMQPTimestamp
+--SKIPIF--
+<?php
+if (!extension_loaded("amqp") || version_compare(PHP_VERSION, '8.0', '<')) {
+  print "skip";
+}
+--FILE--
+<?php
+
+$timestamp = new AMQPTimestamp(100000);
+var_dump($timestamp->getTimestamp(), (string) $timestamp);
+
+$timestamp = new AMQPTimestamp(100000.1);
+var_dump($timestamp->getTimestamp(), (string) $timestamp);
+
+try {
+	new AMQPTimestamp();
+} catch(ArgumentCountError $e) {
+	echo $e->getMessage() . "\n";
+}
+try {
+	new AMQPTimestamp("string");
+} catch(TypeError $e) {
+	echo $e->getMessage() . "\n";
+}
+
+try {
+    new AMQPTimestamp(AMQPTimestamp::MIN - 1);
+} catch (AMQPValueException $e) {
+    echo $e->getMessage() . "\n";
+}
+
+try {
+    new AMQPTimestamp(INF);
+} catch (AMQPValueException $e) {
+    echo $e->getMessage() . "\n";
+}
+
+var_dump((new ReflectionClass("AMQPTimestamp"))->isFinal());
+
+var_dump(AMQPTimestamp::MAX);
+var_dump(AMQPTimestamp::MIN);
+?>
+
+==END==
+--EXPECTF--
+string(6) "100000"
+string(6) "100000"
+string(6) "100000"
+string(6) "100000"
+AMQPTimestamp::__construct() expects exactly 1 parameter, 0 given
+AMQPTimestamp::__construct(): Argument #1 ($timestamp) must be of type float, string given
+The timestamp parameter must be greater than 0.
+The timestamp parameter must be less than 18446744073709551616.
+bool(true)
+string(20) "18446744073709551616"
+string(1) "0"
+
+==END==