File: 0007-Adapt-to-recent-version-of-PHPUnit-10.patch

package info (click to toggle)
phpseclib 1.0.23-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,928 kB
  • sloc: php: 11,790; sh: 66; xml: 50; makefile: 21
file content (105 lines) | stat: -rw-r--r-- 4,139 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
97
98
99
100
101
102
103
104
105
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Mon, 29 May 2023 11:58:10 +0200
Subject: Adapt to recent version of PHPUnit (10)

---
 tests/Functional/Net/SSH2Test.php |  2 +-
 tests/PhpseclibTestCase.php       | 44 ---------------------------------------
 tests/Unit/Net/SSH1Test.php       |  2 +-
 tests/Unit/Net/SSH2UnitTest.php   |  2 +-
 4 files changed, 3 insertions(+), 47 deletions(-)

diff --git a/tests/Functional/Net/SSH2Test.php b/tests/Functional/Net/SSH2Test.php
index 18b56a5..3bfca88 100644
--- a/tests/Functional/Net/SSH2Test.php
+++ b/tests/Functional/Net/SSH2Test.php
@@ -107,7 +107,7 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
     public function testExecWithMethodCallback($ssh)
     {
         $callbackObject = $this->getMockBuilder('stdClass')
-            ->setMethods(array('callbackMethod'))
+            ->onlyMethods(array('callbackMethod'))
             ->getMock();
         $callbackObject
             ->expects($this->atLeastOnce())
diff --git a/tests/PhpseclibTestCase.php b/tests/PhpseclibTestCase.php
index 291dd6d..ae825b2 100644
--- a/tests/PhpseclibTestCase.php
+++ b/tests/PhpseclibTestCase.php
@@ -102,50 +102,6 @@ abstract class PhpseclibTestCase extends PHPUnit\Framework\TestCase
         }
     }
 
-    // assertIsArray was not introduced until PHPUnit 8
-    public static function assertIsArray($actual, string $message = ''): void
-    {
-        if (method_exists('\PHPUnit\Framework\TestCase', 'assertIsArray')) {
-            parent::assertIsArray($actual, $message);
-            return;
-        }
-
-        parent::assertInternalType('array', $actual, $message);
-    }
-
-    // assertIsString was not introduced until PHPUnit 8
-    public static function assertIsString($actual, string $message = ''): void
-    {
-        if (method_exists('\PHPUnit\Framework\TestCase', 'assertIsString')) {
-            parent::assertIsString($actual, $message);
-            return;
-        }
-
-        parent::assertInternalType('string', $actual, $message);
-    }
-
-    // assertContains is deprecated for strings in PHPUnit 8
-    public static function assertStringContainsString(string $needle, string $haystack, string $message = ''): void
-    {
-        if (method_exists('\PHPUnit\Framework\TestCase', 'assertStringContainsString')) {
-            parent::assertStringContainsString($needle, $haystack, $message);
-            return;
-        }
-
-        parent::assertContains($needle, $haystack, $message);
-    }
-
-    // assertNotContains is deprecated for strings in PHPUnit 8
-    public static function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void
-    {
-        if (method_exists('\PHPUnit\Framework\TestCase', 'assertStringContainsString')) {
-            parent::assertStringNotContainsString($needle, $haystack, $message);
-            return;
-        }
-
-        parent::assertNotContains($needle, $haystack, $message);
-    }
-
     public function setExpectedException($name, $message = null, $code = null)
     {
         if (version_compare(PHP_VERSION, '7.0.0') < 0) {
diff --git a/tests/Unit/Net/SSH1Test.php b/tests/Unit/Net/SSH1Test.php
index b0b2aae..4429b7b 100644
--- a/tests/Unit/Net/SSH1Test.php
+++ b/tests/Unit/Net/SSH1Test.php
@@ -31,7 +31,7 @@ class Unit_Net_SSH1Test extends PhpseclibTestCase
     {
         $ssh = $this->getMockBuilder('Net_SSH1')
             ->disableOriginalConstructor()
-            ->setMethods(null)
+            ->onlyMethods(array())
             ->getMock();
 
         $result = $ssh->_format_log($message_log, $message_number_log);
diff --git a/tests/Unit/Net/SSH2UnitTest.php b/tests/Unit/Net/SSH2UnitTest.php
index a13923f..f6756f0 100644
--- a/tests/Unit/Net/SSH2UnitTest.php
+++ b/tests/Unit/Net/SSH2UnitTest.php
@@ -123,7 +123,7 @@ class Unit_Net_SSH2UnitTest extends PhpseclibTestCase
     {
         return $this->getMockBuilder('Net_SSH2')
             ->disableOriginalConstructor()
-            ->setMethods(array('__destruct'))
+            ->onlyMethods(array('__destruct'))
             ->getMock();
     }
 }