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

package info (click to toggle)
php-horde-imp 6.2.27-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 21,108 kB
  • sloc: php: 36,473; xml: 25,887; javascript: 11,917; makefile: 18; sh: 3
file content (424 lines) | stat: -rw-r--r-- 15,152 bytes parent folder | download | duplicates (2)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
Description: Adapt to PHPUnit 8.x and 9.x API.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

Index: php-horde-imp/imp-6.2.27/test/Imp/Unit/ComposeTest.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/test/Imp/Unit/ComposeTest.php
+++ php-horde-imp/imp-6.2.27/test/Imp/Unit/ComposeTest.php
@@ -23,7 +23,7 @@
  * @package    IMP
  * @subpackage UnitTests
  */
-class Imp_Unit_ComposeTest extends PHPUnit_Framework_TestCase
+class Imp_Unit_ComposeTest extends Horde_Test_Case
 {
     public function testBug10431()
     {
Index: php-horde-imp/imp-6.2.27/test/Imp/Unit/MboxParseTest.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/test/Imp/Unit/MboxParseTest.php
+++ php-horde-imp/imp-6.2.27/test/Imp/Unit/MboxParseTest.php
@@ -23,7 +23,7 @@
  * @package    IMP
  * @subpackage UnitTests
  */
-class Imp_Unit_MboxParseTest extends PHPUnit_Framework_TestCase
+class Imp_Unit_MboxParseTest extends Horde_Test_Case
 {
     public function testMboxParse()
     {
@@ -41,8 +41,7 @@ class Imp_Unit_MboxParseTest extends PHP
                 $key
             );
 
-            $this->assertInternalType(
-                'array',
+            $this->assertIsArray(
                 $val
             );
 
@@ -64,8 +63,7 @@ class Imp_Unit_MboxParseTest extends PHP
 
         $val = $parse[0];
 
-        $this->assertInternalType(
-            'array',
+        $this->assertIsArray(
             $val
         );
 
@@ -75,11 +73,10 @@ class Imp_Unit_MboxParseTest extends PHP
         );
     }
 
-    /**
-     * @expectedException IMP_Exception
-     */
     public function testBadData()
     {
+        $this->expectException('IMP_Exception');
+
         new IMP_Mbox_Parse(__DIR__ . '/noexist');
     }
 
Index: php-horde-imp/imp-6.2.27/test/Imp/Unit/Mime/Viewer/HtmlTest.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/test/Imp/Unit/Mime/Viewer/HtmlTest.php
+++ php-horde-imp/imp-6.2.27/test/Imp/Unit/Mime/Viewer/HtmlTest.php
@@ -23,13 +23,13 @@
  * @package    IMP
  * @subpackage UnitTests
  */
-class Imp_Unit_Mime_Viewer_HtmlTest extends PHPUnit_Framework_TestCase
+class Imp_Unit_Mime_Viewer_HtmlTest extends Horde_Test_Case
 {
-    public function setUp()
+    public function setUp(): void
     {
-        $GLOBALS['browser'] = $this->getMock('Horde_Browser');
+        $GLOBALS['browser'] = $this->getMockBuilder('Horde_Browser')->getMock();
 
-        $prefs = $this->getMock('Horde_Prefs', array(), array(), '', false);
+        $prefs = $this->getMockBuilder('Horde_Prefs')->disableOriginalConstructor()->getMock();
         $prefs->expects($this->any())
             ->method('getValue')
             ->will($this->returnValue(false));
@@ -52,7 +52,7 @@ class Imp_Unit_Mime_Viewer_HtmlTest exte
         );
 
         $v = new IMP_Stub_Mime_Viewer_Html(new Horde_Mime_Part(), array(
-            'browser' => $this->getMock('Horde_Browser'),
+            'browser' => $this->getMockBuilder('Horde_Browser')->getMock(),
             'charset' => 'UTF-8'
         ));
 
@@ -79,7 +79,7 @@ class Imp_Unit_Mime_Viewer_HtmlTest exte
         );
 
         $v = new IMP_Stub_Mime_Viewer_Html(new Horde_Mime_Part(), array(
-            'browser' => $this->getMock('Horde_Browser'),
+            'browser' => $this->getMockBuilder('Horde_Browser')->getMock(),
             'charset' => 'UTF-8'
         ));
 
Index: php-horde-imp/imp-6.2.27/test/Imp/Unit/Mime/Viewer/ItipTest.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/test/Imp/Unit/Mime/Viewer/ItipTest.php
+++ php-horde-imp/imp-6.2.27/test/Imp/Unit/Mime/Viewer/ItipTest.php
@@ -25,7 +25,7 @@
  * @subpackage UnitTests
  */
 class Imp_Unit_Mime_Viewer_ItipTest
-extends PHPUnit_Framework_TestCase
+extends Horde_Test_Case
 {
     private $_contents;
     private $_contentsCharset;
@@ -39,18 +39,18 @@ extends PHPUnit_Framework_TestCase
     private $_notifyStack = array();
     private $_oldtz;
 
-    public function setUp()
+    public function setUp(): void
     {
         $this->_oldtz = date_default_timezone_get();
         date_default_timezone_set('UTC');
 
-        $injector = $this->getMock('Horde_Injector', array(), array(), '', false);
+        $injector = $this->getMockBuilder('Horde_Injector')->disableOriginalConstructor()->getMock();
         $injector->expects($this->any())
             ->method('getInstance')
             ->will($this->returnCallback(array($this, '_injectorGetInstance')));
         $GLOBALS['injector'] = $injector;
 
-        $registry = $this->getMock('Horde_Registry', array(), array(), '', false);
+        $registry = $this->getMockBuilder('Horde_Registry')->setMethods(array('getCharset','remoteHost'))->disableOriginalConstructor()->getMock();
         $registry->expects($this->any())
             ->method('getCharset')
             ->will($this->returnValue('UTF-8'));
@@ -59,7 +59,7 @@ extends PHPUnit_Framework_TestCase
             ->will($this->returnValue((object)array('addr' => '1.2.3.4', 'host' => 'example.com', 'proxy' => false)));
         $GLOBALS['registry'] = $registry;
 
-        $notification = $this->getMock('Horde_Notification_Handler', array(), array(), '', false);
+        $notification = $this->getMockBuilder('Horde_Notification_Handler')->disableOriginalConstructor()->getMock();
         $notification->expects($this->any())
             ->method('push')
             ->will($this->returnCallback(array($this, '_notificationHandler')));
@@ -69,7 +69,7 @@ extends PHPUnit_Framework_TestCase
         $_SERVER['REMOTE_ADDR'] = 'localhost';
     }
 
-    public function tearDown()
+    public function tearDown(): void
     {
         date_default_timezone_set($this->_oldtz);
     }
@@ -85,7 +85,7 @@ extends PHPUnit_Framework_TestCase
 
         case 'IMP_Contents':
             if (!isset($this->_contents)) {
-                $contents= $this->getMock('IMP_Contents', array(), array(), '', false);
+                $contents= $this->getMockBuilder('IMP_Contents')->disableOriginalConstructor()->getMock();
                 $contents->expects($this->any())
                     ->method('getMIMEPart')
                     ->will($this->returnCallback(array($this, '_getMimePart')));
@@ -95,7 +95,7 @@ extends PHPUnit_Framework_TestCase
 
         case 'IMP_Factory_Contents':
             if (!isset($this->_contentsFactory)) {
-                $cf = $this->getMock('IMP_Factory_Contents', array(), array(), '', false);
+                $cf = $this->getMockBuilder('IMP_Factory_Contents')->disableOriginalConstructor()->getMock();
                 $cf->expects($this->any())
                     ->method('create')
                     ->will($this->returnValue($this->_injectorGetInstance('IMP_Contents')));
@@ -105,7 +105,7 @@ extends PHPUnit_Framework_TestCase
 
         case 'IMP_Factory_Imap':
             if (!isset($this->_imapFactory)) {
-                $imap = $this->getMock('IMP_Factory_Imap', array(), array(), '', false);
+                $imap = $this->getMockBuilder('IMP_Factory_Imap')->disableOriginalConstructor()->getMock();
                 $imap->expects($this->any())
                     ->method('create')
                     ->will($this->returnValue(new IMP_Stub_Imap()));
@@ -115,7 +115,7 @@ extends PHPUnit_Framework_TestCase
 
         case 'IMP_Factory_Mailbox':
             if (!isset($this->_mailbox)) {
-                $mbox = $this->getMock('IMP_Factory_Mailbox', array(), array(), '', false);
+                $mbox = $this->getMockBuilder('IMP_Factory_Mailbox')->disableOriginalConstructor()->getMock();
                 $mbox->expects($this->any())
                     ->method('create')
                     ->will($this->returnValue(new IMP_Mailbox('foo')));
@@ -125,7 +125,7 @@ extends PHPUnit_Framework_TestCase
 
         case 'IMP_Identity':
             if (!isset($this->_identity)) {
-                $identity = $this->getMock('Horde_Core_Prefs_Identity', array(), array(), '', false);
+                $identity = $this->getMockBuilder('Horde_Core_Prefs_Identity')->disableOriginalConstructor()->getMock();
                 $identity->expects($this->any())
                     ->method('setDefault')
                     ->will($this->returnCallback(array($this, '_identitySetDefault')));
@@ -232,7 +232,7 @@ extends PHPUnit_Framework_TestCase
     public function testAcceptingAnInvitationResultsInReplySent()
     {
         $this->_doImple('accept', $this->_getInvitation()->exportvCalendar());
-        $this->assertContains('Reply Sent.', reset($this->_notifyStack));
+        $this->assertStringContainsString('Reply Sent.', join(" ", reset($this->_notifyStack)));
     }
 
     /**
@@ -290,6 +290,8 @@ extends PHPUnit_Framework_TestCase
      */
     public function testResultMessageThrowsExceptionIfUidIsMissing()
     {
+        $this->expectNotToPerformAssertions();
+
         try {
             $this->_doImple('accept', "BEGIN:VEVENT\nORGANIZER:somebody@example.com\nDTSTAMP:20100816T143648Z\nDTSTART:20100816T143648Z\nEND:VEVENT");
             $this->fail('Expecting Exception.');
@@ -491,13 +493,13 @@ extends PHPUnit_Framework_TestCase
     public function testResultMimeMessageHeadersContainsReceivedHeader()
     {
         $this->_doImple('accept', $this->_getInvitation()->exportvCalendar());
-        $this->assertContains('(Horde Framework) with HTTP', $this->_getMailHeaders()->getValue('Received'));
+        $this->assertStringContainsString('(Horde Framework) with HTTP', $this->_getMailHeaders()->getValue('Received'));
     }
 
     public function testResultMimeMessageHeadersContainsMessageId()
     {
         $this->_doImple('accept', $this->_getInvitation()->exportvCalendar());
-        $this->assertContains('.Horde.', $this->_getMailHeaders()->getValue('Message-ID'));
+        $this->assertStringContainsString('.Horde.', $this->_getMailHeaders()->getValue('Message-ID'));
     }
 
     public function testResultMimeMessageHeadersContainsDate()
Index: php-horde-imp/imp-6.2.27/test/Imp/Unit/QuotaTest.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/test/Imp/Unit/QuotaTest.php
+++ php-horde-imp/imp-6.2.27/test/Imp/Unit/QuotaTest.php
@@ -23,7 +23,7 @@
  * @package    IMP
  * @subpackage UnitTests
  */
-class Imp_Unit_QuotaTest extends PHPUnit_Framework_TestCase
+class Imp_Unit_QuotaTest extends Horde_Test_Case
 {
     public function testMaildir()
     {
Index: php-horde-imp/imp-6.2.27/test/Imp/phpunit.xml
===================================================================
--- /dev/null
+++ php-horde-imp/imp-6.2.27/test/Imp/phpunit.xml
@@ -0,0 +1 @@
+<phpunit bootstrap="bootstrap.php"></phpunit>
Index: php-horde-imp/imp-6.2.27/lib/Mbox/Parse.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/lib/Mbox/Parse.php
+++ php-horde-imp/imp-6.2.27/lib/Mbox/Parse.php
@@ -98,6 +98,7 @@ class IMP_Mbox_Parse implements ArrayAcc
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetExists($offset)
     {
         return isset($this->_parsed[$offset]);
@@ -105,6 +106,7 @@ class IMP_Mbox_Parse implements ArrayAcc
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetGet($offset)
     {
         if (isset($this->_parsed[$offset])) {
@@ -147,6 +149,7 @@ class IMP_Mbox_Parse implements ArrayAcc
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetSet($offset, $value)
     {
         // NOOP
@@ -154,6 +157,7 @@ class IMP_Mbox_Parse implements ArrayAcc
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetUnset($offset)
     {
         // NOOP
@@ -166,6 +170,7 @@ class IMP_Mbox_Parse implements ArrayAcc
      *
      * @return integer  The number of messages.
      */
+    #[\ReturnTypeWillChange]
     public function count()
     {
         return count($this->_parsed);
@@ -178,6 +183,7 @@ class IMP_Mbox_Parse implements ArrayAcc
      *
      * @return string  String representation.
      */
+    #[\ReturnTypeWillChange]
     public function __toString()
     {
         rewind($this->_data);
@@ -185,7 +191,7 @@ class IMP_Mbox_Parse implements ArrayAcc
     }
 
     /* Iterator methods. */
-
+    #[\ReturnTypeWillChange]
     public function current()
     {
         $key = $this->key();
@@ -195,11 +201,13 @@ class IMP_Mbox_Parse implements ArrayAcc
             : $this[$key];
     }
 
+    #[\ReturnTypeWillChange]
     public function key()
     {
         return key($this->_parsed);
     }
 
+    #[\ReturnTypeWillChange]
     public function next()
     {
         if ($this->valid()) {
@@ -207,11 +215,13 @@ class IMP_Mbox_Parse implements ArrayAcc
         }
     }
 
+    #[\ReturnTypeWillChange]
     public function rewind()
     {
         reset($this->_parsed);
     }
 
+    #[\ReturnTypeWillChange]
     public function valid()
     {
         return !is_null($this->key());
Index: php-horde-imp/imp-6.2.27/lib/Indices.php
===================================================================
--- php-horde-imp.orig/imp-6.2.27/lib/Indices.php
+++ php-horde-imp/imp-6.2.27/lib/Indices.php
@@ -257,6 +257,7 @@ class IMP_Indices implements ArrayAccess
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetExists($offset)
     {
         return isset($this->_indices[$offset]);
@@ -264,6 +265,7 @@ class IMP_Indices implements ArrayAccess
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetGet($offset)
     {
         return isset($this->_indices[$offset])
@@ -273,6 +275,7 @@ class IMP_Indices implements ArrayAccess
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetSet($offset, $value)
     {
         unset($this->_indices[$offset]);
@@ -281,6 +284,7 @@ class IMP_Indices implements ArrayAccess
 
     /**
      */
+    #[\ReturnTypeWillChange]
     public function offsetUnset($offset)
     {
         unset($this->_indices[$offset]);
@@ -293,6 +297,7 @@ class IMP_Indices implements ArrayAccess
      *
      * @return integer  The number of indices.
      */
+    #[\ReturnTypeWillChange]
     public function count()
     {
         $count = 0;
@@ -317,7 +322,7 @@ class IMP_Indices implements ArrayAccess
     }
 
     /* Iterator methods. */
-
+    #[\ReturnTypeWillChange]
     public function current()
     {
         if (!$this->valid()) {
@@ -331,11 +336,13 @@ class IMP_Indices implements ArrayAccess
         return $ret;
     }
 
+    #[\ReturnTypeWillChange]
     public function key()
     {
         return key($this->_indices);
     }
 
+    #[\ReturnTypeWillChange]
     public function next()
     {
         if ($this->valid()) {
@@ -343,11 +350,13 @@ class IMP_Indices implements ArrayAccess
         }
     }
 
+    #[\ReturnTypeWillChange]
     public function rewind()
     {
         reset($this->_indices);
     }
 
+    #[\ReturnTypeWillChange]
     public function valid()
     {
         return !is_null(key($this->_indices));