File: 1010_phpunit-8.x%2B9.x.patch

package info (click to toggle)
php-horde-http 2.1.7-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 308 kB
  • sloc: php: 989; xml: 588; sh: 4; makefile: 2
file content (169 lines) | stat: -rw-r--r-- 7,472 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Description: Adapt to PHPUnit 8.x and 9.x API.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/CurlTest.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/CurlTest.php
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/CurlTest.php
@@ -18,7 +18,7 @@
  */
 class Horde_Http_CurlTest extends Horde_Http_TestBase
 {
-    public function setUp()
+    public function setUp(): void
     {
         if (!function_exists('curl_exec')) {
             $this->markTestSkipped('Missing PHP extension "curl"!');
Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/MockTest.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/MockTest.php
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/MockTest.php
@@ -24,7 +24,7 @@
  * @license    http://www.horde.org/licenses/bsd
  * @link       http://www.horde.org/libraries/Horde_Http
  */
-class Horde_Http_MockTest extends PHPUnit_Framework_TestCase
+class Horde_Http_MockTest extends Horde_Test_Case
 {
     public function testNoResponses()
     {
Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/Peclhttp2Test.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/Peclhttp2Test.php
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/Peclhttp2Test.php
@@ -18,7 +18,7 @@
  */
 class Horde_Http_Peclhttp2Test extends Horde_Http_TestBase
 {
-    public function setUp()
+    public function setUp(): void
     {
         if (!class_exists('\http\Client', false)) {
             $this->markTestSkipped('Missing PHP extension "http" or wrong version!');
Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/PeclhttpTest.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/PeclhttpTest.php
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/PeclhttpTest.php
@@ -18,7 +18,7 @@
  */
 class Horde_Http_PeclhttpTest extends Horde_Http_TestBase
 {
-    public function setUp()
+    public function setUp(): void
     {
         if (!class_exists('HttpRequest', false)) {
             $this->markTestSkipped('Missing PHP extension "http" or wrong version!');
Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/TestBase.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/TestBase.php
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/TestBase.php
@@ -22,13 +22,13 @@ class Horde_Http_TestBase extends Horde_
 
     protected static $_requestClass;
 
-    public static function setUpBeforeClass()
+    public static function setUpBeforeClass(): void
     {
         preg_match('/Horde_Http_(.*)Test/', get_called_class(), $match);
         self::$_requestClass = 'Horde_Http_Request_' . $match[1];
     }
 
-    public function setUp()
+    public function setUp(): void
     {
         $config = self::getConfig('HTTP_TEST_CONFIG');
         if ($config && !empty($config['http']['server'])) {
@@ -47,10 +47,10 @@ class Horde_Http_TestBase extends Horde_
         $this->assertStringStartsWith('http', $response->uri);
         $this->assertStringStartsWith('1.', $response->httpVersion);
         $this->assertEquals(200, $response->code);
-        $this->assertInternalType('array', $response->headers);
-        $this->assertInternalType('string', $response->getBody());
+        $this->assertIsArray($response->headers);
+        $this->assertIsString($response->getBody());
         $this->assertGreaterThan(0, strlen($response->getBody()));
-        $this->assertInternalType('resource', $response->getStream());
+        $this->assertIsResource($response->getStream());
         $this->assertStringMatchesFormat(
             '%s/%s',
             $response->getHeader('Content-Type')
@@ -66,22 +66,18 @@ class Horde_Http_TestBase extends Horde_
         );
     }
 
-    /**
-     * @expectedException Horde_Http_Exception
-     */
     public function testThrowsOnBadUri()
     {
+        $this->expectException('Horde_Http_Exception');
         $client = new Horde_Http_Client(
             array('request' => new self::$_requestClass())
         );
         $client->get('http://doesntexist/');
     }
 
-    /**
-     * @expectedException Horde_Http_Exception
-     */
     public function testThrowsOnInvalidProxyType()
     {
+        $this->expectException('Horde_Http_Exception');
         $client = new Horde_Http_Client(
             array(
                 'request' => new self::$_requestClass(
Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/ClientTest.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/ClientTest.php
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/ClientTest.php
@@ -34,11 +34,9 @@ class Horde_Http_ClientTest extends Hord
         $this->assertEquals(10, $request->timeout);
     }
 
-    /**
-     * @expectedException Horde_Http_Exception
-     */
     public function testSetUnknownOption()
     {
+        $this->expectException('Horde_Http_Exception');
         $request = new Horde_Http_Request_Mock();
         $client = new Horde_Http_Client(
             array('request' => $request)
Index: php-horde-http/Horde_Http-2.1.7/lib/Horde/Http/Request/Fopen.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/lib/Horde/Http/Request/Fopen.php
+++ php-horde-http/Horde_Http-2.1.7/lib/Horde/Http/Request/Fopen.php
@@ -138,8 +138,7 @@ class Horde_Http_Request_Fopen extends H
      * @param integer $errline   See set_error_handler().
      * @param array $errcontext  See set_error_handler().
      */
-    protected function _errorHandler($errno, $errstr, $errfile, $errline,
-                                     $errcontext)
+    protected function _errorHandler($errno, $errstr, $errfile, $errline)
     {
         array_unshift($this->_errors, preg_replace('/^(.*?) \[<a href[^\]]*\](.*)/', '$1$2', $errstr));
     }
Index: php-horde-http/Horde_Http-2.1.7/lib/Horde/Http/Request/Peclhttp2.php
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/lib/Horde/Http/Request/Peclhttp2.php
+++ php-horde-http/Horde_Http-2.1.7/lib/Horde/Http/Request/Peclhttp2.php
@@ -69,7 +69,7 @@ class Horde_Http_Request_Peclhttp2 exten
         if (is_array($data)) {
             $body->addForm($data);
         } else {
-            $body->append($data);
+            $body->append(is_null($data) ? "" : $data);
         }
 
         $httpRequest = new \http\Client\Request($this->method, (string)$this->uri, $this->headers, $body);
Index: php-horde-http/Horde_Http-2.1.7/test/Horde/Http/phpunit.xml
===================================================================
--- php-horde-http.orig/Horde_Http-2.1.7/test/Horde/Http/phpunit.xml
+++ php-horde-http/Horde_Http-2.1.7/test/Horde/Http/phpunit.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="bootstrap.php">
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
   <filter>
     <whitelist>
       <directory suffix=".php">../../../lib</directory>