File: 0006-Drop-PHPUnit-10-Updates.patch

package info (click to toggle)
php-phpseclib3 3.0.19-1%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,136 kB
  • sloc: php: 29,413; xml: 393; makefile: 20
file content (92 lines) | stat: -rw-r--r-- 3,439 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
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Mon, 6 Mar 2023 08:16:37 +0100
Subject: Drop PHPUnit 10 Updates

Origin: backport, https://github.com/phpseclib/phpseclib/commit/508eaa7197f254d015d75744d552255fcec0ce57
---
 tests/PhpseclibTestCase.php | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/PhpseclibTestCase.php b/tests/PhpseclibTestCase.php
index 8a08949..bcd7a81 100644
--- a/tests/PhpseclibTestCase.php
+++ b/tests/PhpseclibTestCase.php
@@ -105,36 +105,66 @@ abstract class PhpseclibTestCase extends TestCase
     // assertIsArray was not introduced until PHPUnit 8
     public static function assertIsArray($actual, $message = ''): void
     {
+        if (method_exists(parent::class, 'assertIsArray')) {
+            parent::assertIsArray($actual, $message);
+            return;
+        }
+
         parent::assertInternalType('array', $actual, $message);
     }
 
     // assertIsString was not introduced until PHPUnit 8
     public static function assertIsString($actual, $message = ''): void
     {
+        if (method_exists(parent::class, 'assertIsString')) {
+            parent::assertIsString($actual, $message);
+            return;
+        }
+
         parent::assertInternalType('string', $actual, $message);
     }
 
     // assertIsResource was not introduced until PHPUnit 8
     public static function assertIsResource($actual, $message = ''): void
     {
+        if (method_exists(parent::class, 'assertIsResource')) {
+            parent::assertIsResource($actual, $message);
+            return;
+        }
+
         parent::assertInternalType('resource', $actual, $message);
     }
 
     // assertIsObject was not introduced until PHPUnit 8
     public static function assertIsObject($actual, $message = ''): void
     {
+        if (method_exists(parent::class, 'assertIsObject')) {
+            parent::assertIsObject($actual, $message);
+            return;
+        }
+
         parent::assertInternalType('object', $actual, $message);
     }
 
     // assertContains is deprecated for strings in PHPUnit 8
     public static function assertStringContainsString($needle, $haystack, $message = ''): void
     {
+        if (method_exists(parent::class, 'assertStringContainsString')) {
+            parent::assertStringContainsString($needle, $haystack, $message);
+            return;
+        }
+
         parent::assertContains($needle, $haystack, $message);
     }
 
     // assertNotContains is deprecated for strings in PHPUnit 8
     public static function assertStringNotContainsString($needle, $haystack, $message = ''): void
     {
+        if (method_exists(parent::class, 'assertStringContainsString')) {
+            parent::assertStringNotContainsString($needle, $haystack, $message);
+            return;
+        }
+
         parent::assertNotContains($needle, $haystack, $message);
     }
 
@@ -148,6 +178,10 @@ abstract class PhpseclibTestCase extends TestCase
      */
     public static function assertMatchesRegularExpression($pattern, $string, $message = ''): void
     {
-        parent::assertRegExp($pattern, $string, $message);
+        if (method_exists(parent::class, 'assertMatchesRegularExpression')) {
+            parent::assertMatchesRegularExpression($pattern, $string, $message);
+        } else {
+            parent::assertRegExp($pattern, $string, $message);
+        }
     }
 }