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

package info (click to toggle)
php-horde-support 2.2.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 432 kB
  • sloc: php: 2,177; xml: 535; sh: 3; makefile: 2
file content (386 lines) | stat: -rw-r--r-- 15,533 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
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
Description: Adapt to PHPUnit 8.x and 9.x API
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>

--- a/Horde_Support-2.2.0/test/Horde/Support/ArrayTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/ArrayTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_ArrayTest extends PHPUnit_Framework_TestCase
+class Horde_Support_ArrayTest extends Horde_Test_Case
 {
     public function testImplementsArrayAccess()
     {
@@ -137,12 +137,16 @@
 
     public function testUpdateDoesNotThrowWhenArgumentIsAnArray()
     {
+        $this->expectNotToPerformAssertions();
+
         $o = new Horde_Support_Array();
         $o->update(array());
     }
 
     public function testUpdateDoesNotThrowWhenArgumentIsTraversable()
     {
+        $this->expectNotToPerformAssertions();
+
         $o = new Horde_Support_Array();
         $o->update(new ArrayObject());
     }
--- a/Horde_Support-2.2.0/test/Horde/Support/BacktraceTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/BacktraceTest.php
@@ -19,7 +19,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_BacktraceTest extends PHPUnit_Framework_TestCase
+class Horde_Support_BacktraceTest extends Horde_Test_Case
 {
     // Keep these two methods on the top so that the line numbers don't change
     // when new tests are added.
@@ -87,7 +87,7 @@
     {
         $backtrace = new Horde_Support_Backtrace(array_slice($this->instanceMethod(), 0, 4));
         $file = __FILE__;
-        $this->assertEquals("1. Horde_Support_BacktraceTest->testToString()
+        $this->assertEquals("1. Horde_Support_BacktraceTest->testToString() /usr/share/php/PHPUnit/Framework/TestCase.php:1408
 2. Horde_Support_BacktraceTest->instanceMethod() $file:88
 3. Horde_Support_BacktraceTest::staticMethod() $file:28
 4. backtraceTestFunction() $file:33
--- a/Horde_Support-2.2.0/test/Horde/Support/CaseInsensitiveArrayTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/CaseInsensitiveArrayTest.php
@@ -16,7 +16,7 @@
  * @package    Support
  * @subpackage UnitTests
  */
-class Horde_Support_CaseInsensitiveArrayTest extends PHPUnit_Framework_TestCase
+class Horde_Support_CaseInsensitiveArrayTest extends Horde_Test_Case
 {
     /**
      * @dataProvider implementsProvider
--- a/Horde_Support-2.2.0/test/Horde/Support/CombineStreamTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/CombineStreamTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_CombineStreamTest extends PHPUnit_Framework_TestCase
+class Horde_Support_CombineStreamTest extends Horde_Test_Case
 {
     public function testUsage()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/ConsistentHashTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/ConsistentHashTest.php
@@ -14,30 +14,32 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_ConsistentHashTest extends PHPUnit_Framework_TestCase
+class Horde_Support_ConsistentHashTest extends Horde_Test_Case
 {
     public function testAddUpdatesCount()
     {
         $h = new Horde_Support_ConsistentHash;
-        $this->assertEquals(0, $this->readAttribute($h, '_nodeCount'));
+        $this->assertEquals(0, $this->getPrivatePropertyValue($h, '_nodeCount'));
 
         $h->add('a');
-        $this->assertEquals(1, $this->readAttribute($h, '_nodeCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_nodes')), $this->readAttribute($h, '_nodeCount'));
+        $this->assertEquals(1, $this->getPrivatePropertyValue($h, '_nodeCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_nodes')), $this->getPrivatePropertyValue($h, '_nodeCount'));
     }
 
+    // https://www.webtipblog.com/unit-testing-private-methods-and-properties-with-phpunit/
+
     public function testAddUpdatesPointCount()
     {
         $numberOfReplicas = 100;
         $h = new Horde_Support_ConsistentHash(array(), 1, $numberOfReplicas);
-        $this->assertEquals(0, $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_circle')), $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_pointMap')), $this->readAttribute($h, '_pointCount'));
+        $this->assertEquals(0, $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_circle')), $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_pointMap')), $this->getPrivatePropertyValue($h, '_pointCount'));
 
         $h->add('a');
-        $this->assertEquals(100, $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_circle')), $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_pointMap')), $this->readAttribute($h, '_pointCount'));
+        $this->assertEquals(100, $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_circle')), $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_pointMap')), $this->getPrivatePropertyValue($h, '_pointCount'));
     }
 
     public function testAddWithWeightGeneratesMorePoints()
@@ -45,33 +47,33 @@
         $weight = 2;
         $numberOfReplicas = 100;
         $h = new Horde_Support_ConsistentHash(array(), 1, $numberOfReplicas);
-        $this->assertEquals(0, $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_circle')), $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_pointMap')), $this->readAttribute($h, '_pointCount'));
+        $this->assertEquals(0, $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_circle')), $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_pointMap')), $this->getPrivatePropertyValue($h, '_pointCount'));
 
         $h->add('a', $weight);
-        $this->assertEquals($numberOfReplicas * $weight, $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_circle')), $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_pointMap')), $this->readAttribute($h, '_pointCount'));
+        $this->assertEquals($numberOfReplicas * $weight, $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_circle')), $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_pointMap')), $this->getPrivatePropertyValue($h, '_pointCount'));
     }
 
     public function testRemoveRemovesPoints()
     {
         $h = new Horde_Support_ConsistentHash;
-        $this->assertEquals(0, $this->readAttribute($h, '_nodeCount'));
+        $this->assertEquals(0, $this->getPrivatePropertyValue($h, '_nodeCount'));
 
         $h->add('a');
         $h->remove('a');
-        $this->assertEquals(0, $this->readAttribute($h, '_nodeCount'));
-        $this->assertEquals(0, $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_circle')), $this->readAttribute($h, '_pointCount'));
-        $this->assertEquals(count($this->readAttribute($h, '_pointMap')), $this->readAttribute($h, '_pointCount'));
+        $this->assertEquals(0, $this->getPrivatePropertyValue($h, '_nodeCount'));
+        $this->assertEquals(0, $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_circle')), $this->getPrivatePropertyValue($h, '_pointCount'));
+        $this->assertEquals(count($this->getPrivatePropertyValue($h, '_pointMap')), $this->getPrivatePropertyValue($h, '_pointCount'));
     }
 
     public function testRemoveThrowsOnNonexistentNode()
     {
         $h = new Horde_Support_ConsistentHash;
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException('InvalidArgumentException');
         $h->remove('a');
     }
 
@@ -152,13 +154,15 @@
         $h = new Horde_Support_ConsistentHash(range(1, 10));
         $nodes = $h->getNodes('r', 2);
 
-        $this->assertInternalType('array', $nodes);
+        $this->assertIsArray($nodes);
         $this->assertEquals(count($nodes), 2);
         $this->assertNotEquals($nodes[0], $nodes[1]);
     }
 
     public function testGetNodesWithNotEnoughNodes()
     {
+        $this->expectNotToPerformAssertions();
+
         $h = new Horde_Support_ConsistentHash(array('t'));
 
         try {
--- a/Horde_Support-2.2.0/test/Horde/Support/GuidTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/GuidTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_GuidTest extends PHPUnit_Framework_TestCase
+class Horde_Support_GuidTest extends Horde_Test_Case
 {
     public function testFormat()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/InflectorTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/InflectorTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_InflectorTest extends PHPUnit_Framework_TestCase
+class Horde_Support_InflectorTest extends Horde_Test_Case
 {
     /**
      * Words to test
@@ -37,7 +37,7 @@
         'mouse' => 'mice',
     );
 
-    public function setUp()
+    public function setUp(): void
     {
         $this->inflector = new Horde_Support_Inflector;
     }
--- a/Horde_Support-2.2.0/test/Horde/Support/MemoryTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/MemoryTest.php
@@ -14,19 +14,19 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_MemoryTest extends PHPUnit_Framework_TestCase
+class Horde_Support_MemoryTest extends Horde_Test_Case
 {
     public function testMemoryStart()
     {
         $t = new Horde_Support_Memory;
-        $this->assertInternalType('array', $t->push());
+        $this->assertIsArray($t->push());
     }
 
     public function testMemoryEnd()
     {
         $t = new Horde_Support_Memory;
         $t->push();
-        $this->assertInternalType('array', $t->pop());
+        $this->assertIsArray($t->pop());
     }
 
     public function testStartValues()
@@ -53,6 +53,8 @@
 
     public function testNotPushedThrowsException()
     {
+        $this->expectNotToPerformAssertions();
+
         $t = new Horde_Support_Memory();
         try {
             $t->pop();
--- a/Horde_Support-2.2.0/test/Horde/Support/Numerizer/Locale/BaseTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/Numerizer/Locale/BaseTest.php
@@ -10,7 +10,7 @@
  * @package    Support
  * @subpackage UnitTests
  */
-class Horde_Support_Numerizer_Locale_BaseTest extends PHPUnit_Framework_TestCase
+class Horde_Support_Numerizer_Locale_BaseTest extends Horde_Test_Case
 {
     public function testStraightParsing()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/Numerizer/Locale/DeTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/Numerizer/Locale/DeTest.php
@@ -10,7 +10,7 @@
  * @package    Support
  * @subpackage UnitTests
  */
-class Horde_Support_Numerizer_Locale_DeTest extends PHPUnit_Framework_TestCase
+class Horde_Support_Numerizer_Locale_DeTest extends Horde_Test_Case
 {
     public function testStraightParsing()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/ObjectStubTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/ObjectStubTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_ObjectStubTest extends PHPUnit_Framework_TestCase
+class Horde_Support_ObjectStubTest extends Horde_Test_Case
 {
     public function testUndefinedIndex()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/RandomidTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/RandomidTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_RandomidTest extends PHPUnit_Framework_TestCase
+class Horde_Support_RandomidTest extends Horde_Test_Case
 {
     public function testLength()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/StackTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/StackTest.php
@@ -14,10 +14,12 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_StackTest extends PHPUnit_Framework_TestCase
+class Horde_Support_StackTest extends Horde_Test_Case
 {
     public function testEmptyConstructor()
     {
+        $this->expectNotToPerformAssertions();
+
         return new Horde_Support_Stack();
     }
 
@@ -26,6 +28,8 @@
      */
     public function testPushOnEmptyStack($stack)
     {
+        $this->expectNotToPerformAssertions();
+
         $stack->push('one');
         $stack->push('two');
         return $stack;
@@ -55,6 +59,8 @@
 
     public function testPrefilledConstructor()
     {
+        $this->expectNotToPerformAssertions();
+
         return new Horde_Support_Stack(array('foo', 'bar'));
     }
 
@@ -72,6 +78,8 @@
      */
     public function testPushOnPrefilledStack($stack)
     {
+        $this->expectNotToPerformAssertions();
+
         $stack->push('baz');
         return $stack;
     }
--- a/Horde_Support-2.2.0/test/Horde/Support/StringStreamTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/StringStreamTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_StringStreamTest extends PHPUnit_Framework_TestCase
+class Horde_Support_StringStreamTest extends Horde_Test_Case
 {
     public function testMemoryUsage()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/StubTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/StubTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_StubTest extends PHPUnit_Framework_TestCase
+class Horde_Support_StubTest extends Horde_Test_Case
 {
     public function testAnyOffsetIsGettable()
     {
--- a/Horde_Support-2.2.0/test/Horde/Support/TimerTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/TimerTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_TimerTest extends PHPUnit_Framework_TestCase
+class Horde_Support_TimerTest extends Horde_Test_Case
 {
     /**
      * test instantiating a normal timer
@@ -35,6 +35,8 @@
      */
     public function testNotStartedYetThrowsException()
     {
+        $this->expectNotToPerformAssertions();
+
         $t = new Horde_Support_Timer();
         try {
             $t->pop();
--- a/Horde_Support-2.2.0/test/Horde/Support/UuidTest.php
+++ b/Horde_Support-2.2.0/test/Horde/Support/UuidTest.php
@@ -14,7 +14,7 @@
  * @subpackage UnitTests
  * @license    http://www.horde.org/licenses/bsd
  */
-class Horde_Support_UuidTest extends PHPUnit_Framework_TestCase
+class Horde_Support_UuidTest extends Horde_Test_Case
 {
     public function testLength()
     {