File: 0001-Compatibility-with-recent-PHPUnit-12.patch

package info (click to toggle)
php-composer-semver 3.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 628 kB
  • sloc: php: 4,307; makefile: 6
file content (481 lines) | stat: -rw-r--r-- 19,152 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
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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Wed, 12 Feb 2025 21:42:46 +0100
Subject: Compatibility with recent PHPUnit (12)

---
 tests/ComparatorTest.php                     |  8 ++++++++
 tests/Constraint/ConstraintTest.php          |  8 ++++++++
 tests/Constraint/MatchAllConstraintTest.php  |  2 ++
 tests/Constraint/MatchNoneConstraintTest.php |  2 ++
 tests/Constraint/MultiConstraintTest.php     |  6 ++++++
 tests/IntervalsTest.php                      |  3 +++
 tests/SemverTest.php                         |  4 ++++
 tests/SubsetsTest.php                        |  3 +++
 tests/VersionParserTest.php                  | 29 ++++++++++++++++++++++------
 9 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/tests/ComparatorTest.php b/tests/ComparatorTest.php
index ee3240c..1701176 100644
--- a/tests/ComparatorTest.php
+++ b/tests/ComparatorTest.php
@@ -11,6 +11,7 @@
 
 namespace Composer\Semver;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Composer\Semver\Constraint\Constraint;
 
@@ -29,6 +30,7 @@ class ComparatorTest extends TestCase
      * @param string $version2
      * @param bool   $expected
      */
+    #[DataProvider('greaterThanProvider')]
     public function testGreaterThan($version1, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::greaterThan($version1, $version2));
@@ -44,6 +46,7 @@ class ComparatorTest extends TestCase
      * @param string $version2
      * @param bool   $expected
      */
+    #[DataProvider('greaterThanOrEqualToProvider')]
     public function testGreaterThanOrEqualTo($version1, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::greaterThanOrEqualTo($version1, $version2));
@@ -59,6 +62,7 @@ class ComparatorTest extends TestCase
      * @param string $version2
      * @param bool   $expected
      */
+    #[DataProvider('lessThanProvider')]
     public function testLessThan($version1, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::lessThan($version1, $version2));
@@ -74,6 +78,7 @@ class ComparatorTest extends TestCase
      * @param string $version2
      * @param bool   $expected
      */
+    #[DataProvider('lessThanOrEqualToProvider')]
     public function testLessThanOrEqualTo($version1, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::lessThanOrEqualTo($version1, $version2));
@@ -89,6 +94,7 @@ class ComparatorTest extends TestCase
      * @param string $version2
      * @param bool   $expected
      */
+    #[DataProvider('equalToProvider')]
     public function testEqualTo($version1, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::equalTo($version1, $version2));
@@ -104,6 +110,7 @@ class ComparatorTest extends TestCase
      * @param string $version2
      * @param bool   $expected
      */
+    #[DataProvider('notEqualToProvider')]
     public function testNotEqualTo($version1, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::notEqualTo($version1, $version2));
@@ -120,6 +127,7 @@ class ComparatorTest extends TestCase
      *
      * @phpstan-param Constraint::STR_OP_* $operator
      */
+    #[DataProvider('compareProvider')]
     public function testCompare($version1, $operator, $version2, $expected)
     {
         $this->assertEquals($expected, Comparator::compare($version1, $operator, $version2));
diff --git a/tests/Constraint/ConstraintTest.php b/tests/Constraint/ConstraintTest.php
index d515d5b..831be7b 100644
--- a/tests/Constraint/ConstraintTest.php
+++ b/tests/Constraint/ConstraintTest.php
@@ -13,6 +13,8 @@ namespace Composer\Semver\Constraint;
 
 use Exception;
 use LogicException;
+use PHPUnit\Framework\Attributes\Before;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Composer\Semver\Intervals;
 
@@ -31,6 +33,7 @@ class ConstraintTest extends TestCase
      * @before
      * @return void
      */
+    #[Before()]
     public function setUpTestCase()
     {
         $this->constraint = new Constraint('==', '1');
@@ -175,6 +178,7 @@ class ConstraintTest extends TestCase
      * @param Constraint::STR_OP_* $provideOperator
      * @param string $provideVersion
      */
+    #[DataProvider('successfulVersionMatches')]
     public function testVersionMatchSucceeds($requireOperator, $requireVersion, $provideOperator, $provideVersion)
     {
         $versionRequire = new Constraint($requireOperator, $requireVersion);
@@ -352,6 +356,7 @@ class ConstraintTest extends TestCase
      * @param Constraint::STR_OP_* $provideOperator
      * @param string $provideVersion
      */
+    #[DataProvider('failingVersionMatches')]
     public function testVersionMatchFails($requireOperator, $requireVersion, $provideOperator, $provideVersion)
     {
         $versionRequire = new Constraint($requireOperator, $requireVersion);
@@ -430,6 +435,7 @@ class ConstraintTest extends TestCase
      * @param Constraint::STR_OP_* $operator
      * @param class-string<Exception> $expected
      */
+    #[DataProvider('invalidOperators')]
     public function testInvalidOperators($version, $operator, $expected)
     {
         $this->doExpectException($expected);
@@ -457,6 +463,7 @@ class ConstraintTest extends TestCase
      * @param Bound  $expectedLower
      * @param Bound  $expectedUpper
      */
+    #[DataProvider('bounds')]
     public function testBounds($operator, $normalizedVersion, Bound $expectedLower, Bound $expectedUpper)
     {
         $constraint = new Constraint($operator, $normalizedVersion);
@@ -514,6 +521,7 @@ class ConstraintTest extends TestCase
      * @param Constraint::STR_OP_* $provideOperator
      * @param string $provideVersion
      */
+    #[DataProvider('matrix')]
     public function testCompile($requireOperator, $requireVersion, $provideOperator, $provideVersion)
     {
         $require = new Constraint($requireOperator, $requireVersion);
diff --git a/tests/Constraint/MatchAllConstraintTest.php b/tests/Constraint/MatchAllConstraintTest.php
index ad4152e..54967d5 100644
--- a/tests/Constraint/MatchAllConstraintTest.php
+++ b/tests/Constraint/MatchAllConstraintTest.php
@@ -11,6 +11,7 @@
 
 namespace Composer\Semver\Constraint;
 
+use PHPUnit\Framework\Attributes\Before;
 use PHPUnit\Framework\TestCase;
 
 class MatchAllConstraintTest extends TestCase
@@ -28,6 +29,7 @@ class MatchAllConstraintTest extends TestCase
      * @before
      * @return void
      */
+    #[Before()]
     public function setUpTestCase()
     {
         $this->versionProvide = new Constraint('==', '1.1');
diff --git a/tests/Constraint/MatchNoneConstraintTest.php b/tests/Constraint/MatchNoneConstraintTest.php
index 801d2af..e9f2289 100644
--- a/tests/Constraint/MatchNoneConstraintTest.php
+++ b/tests/Constraint/MatchNoneConstraintTest.php
@@ -11,6 +11,7 @@
 
 namespace Composer\Semver\Constraint;
 
+use PHPUnit\Framework\Attributes\Before;
 use PHPUnit\Framework\TestCase;
 
 class MatchNoneConstraintTest extends TestCase
@@ -24,6 +25,7 @@ class MatchNoneConstraintTest extends TestCase
      * @before
      * @return void
      */
+    #[Before()]
     public function setUpTestCase()
     {
         $this->matchNoneConstraint = new MatchNoneConstraint();
diff --git a/tests/Constraint/MultiConstraintTest.php b/tests/Constraint/MultiConstraintTest.php
index f8e8684..385a8a6 100644
--- a/tests/Constraint/MultiConstraintTest.php
+++ b/tests/Constraint/MultiConstraintTest.php
@@ -12,6 +12,8 @@
 namespace Composer\Semver\Constraint;
 
 use Composer\Semver\VersionParser;
+use PHPUnit\Framework\Attributes\Before;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Composer\Semver\Intervals;
 
@@ -30,6 +32,7 @@ class MultiConstraintTest extends TestCase
      * @before
      * @return void
      */
+    #[Before()]
     public function setUpTestCase()
     {
         $this->versionRequireStart = new Constraint('>', '1.0');
@@ -147,6 +150,7 @@ class MultiConstraintTest extends TestCase
      * @param Bound $expectedLower
      * @param Bound $expectedUpper
      */
+    #[DataProvider('bounds')]
     public function testBounds(array $constraints, $conjunctive, Bound $expectedLower, Bound $expectedUpper)
     {
         $constraint = new MultiConstraint($constraints, $conjunctive);
@@ -218,6 +222,7 @@ class MultiConstraintTest extends TestCase
      * @param Bound  $expectedLower
      * @param Bound  $expectedUpper
      */
+    #[DataProvider('boundsIntegration')]
     public function testBoundsIntegrationWithVersionParser($constraints, Bound $expectedLower, Bound $expectedUpper)
     {
         $versionParser = new VersionParser();
@@ -313,6 +318,7 @@ class MultiConstraintTest extends TestCase
      *
      * @param string $constraints
      */
+    #[DataProvider('multiConstraintOptimizations')]
     public function testMultiConstraintOptimizations($constraints, ConstraintInterface $expectedConstraint)
     {
         // We're using the version parser here because that uses MultiConstraint::create() internally and
diff --git a/tests/IntervalsTest.php b/tests/IntervalsTest.php
index 457d8e3..19ced5c 100644
--- a/tests/IntervalsTest.php
+++ b/tests/IntervalsTest.php
@@ -11,6 +11,7 @@
 
 namespace Composer\Semver;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Composer\Semver\Constraint\ConstraintInterface;
 use Composer\Semver\Constraint\MultiConstraint;
@@ -32,6 +33,7 @@ class IntervalsTest extends TestCase
      * @param array<string> $toCompact
      * @param bool $conjunctive
      */
+    #[DataProvider('compactProvider')]
     public function testCompactConstraint($expected, $toCompact, $conjunctive)
     {
         $parser = new VersionParser;
@@ -197,6 +199,7 @@ class IntervalsTest extends TestCase
      * @param array<mixed>|self::INTERVAL_* $expected
      * @param string $constraint
      */
+    #[DataProvider('intervalsProvider')]
     public function testGetIntervals($expected, $constraint)
     {
         if (is_string($constraint)) {
diff --git a/tests/SemverTest.php b/tests/SemverTest.php
index 3bbb30f..e0d318c 100644
--- a/tests/SemverTest.php
+++ b/tests/SemverTest.php
@@ -11,6 +11,7 @@
 
 namespace Composer\Semver;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -26,6 +27,7 @@ class SemverTest extends TestCase
      * @param string $version
      * @param string $constraint
      */
+    #[DataProvider('satisfiesProvider')]
     public function testSatisfies($expected, $version, $constraint)
     {
         $this->assertEquals($expected, Semver::satisfies($version, $constraint));
@@ -39,6 +41,7 @@ class SemverTest extends TestCase
      * @param array<string> $versions
      * @param array<string> $expected
      */
+    #[DataProvider('satisfiedByProvider')]
     public function testSatisfiedBy($constraint, $versions, $expected)
     {
         $this->assertEquals($expected, Semver::satisfiedBy($versions, $constraint));
@@ -54,6 +57,7 @@ class SemverTest extends TestCase
      * @param array<string> $sorted
      * @param array<string> $rsorted
      */
+    #[DataProvider('sortProvider')]
     public function testSort(array $versions, array $sorted, array $rsorted)
     {
         $this->assertEquals($sorted, Semver::sort($versions));
diff --git a/tests/SubsetsTest.php b/tests/SubsetsTest.php
index 72f8d74..46c4348 100644
--- a/tests/SubsetsTest.php
+++ b/tests/SubsetsTest.php
@@ -11,6 +11,7 @@
 
 namespace Composer\Semver;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Composer\Semver\Constraint\MatchNoneConstraint;
 use Composer\Semver\Constraint\MatchAllConstraint;
@@ -22,6 +23,7 @@ class SubsetsTest extends TestCase
      * @param string $aStr
      * @param string $bStr
      */
+    #[DataProvider('subsets')]
     public function testIsSubsetOf($aStr, $bStr)
     {
         $versionParser = new VersionParser;
@@ -89,6 +91,7 @@ class SubsetsTest extends TestCase
      * @param string $aStr
      * @param string $bStr
      */
+    #[DataProvider('notSubsets')]
     public function testIsNotSubsetOf($aStr, $bStr)
     {
         $versionParser = new VersionParser;
diff --git a/tests/VersionParserTest.php b/tests/VersionParserTest.php
index 9eedac3..fe5ad7a 100644
--- a/tests/VersionParserTest.php
+++ b/tests/VersionParserTest.php
@@ -16,6 +16,7 @@ use Composer\Semver\Constraint\MultiConstraint;
 use Composer\Semver\Constraint\Constraint;
 use Exception;
 use LogicException;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 
 class VersionParserTest extends TestCase
@@ -25,6 +26,7 @@ class VersionParserTest extends TestCase
      * @param string $input
      * @param string $expected
      */
+    #[DataProvider('numericAliasVersions')]
     public function testParseNumericAliasPrefix($input, $expected)
     {
         $parser = new VersionParser();
@@ -54,6 +56,7 @@ class VersionParserTest extends TestCase
      * @param string $input
      * @param string $expected
      */
+    #[DataProvider('successfulNormalizedVersions')]
     public function testNormalizeSucceeds($input, $expected)
     {
         $parser = new VersionParser();
@@ -149,6 +152,7 @@ class VersionParserTest extends TestCase
      * @dataProvider failingNormalizedVersions
      * @param string $input
      */
+    #[DataProvider('failingNormalizedVersions')]
     public function testNormalizeFails($input)
     {
         $this->doExpectException('UnexpectedValueException');
@@ -182,12 +186,12 @@ class VersionParserTest extends TestCase
             'constraint' => array('~1'),
             'constraint/2' => array('^1'),
             'constraint/3' => array('1.*'),
-            'date versions with 4 bits' => array('20100102.0.3.4', '20100102.0.3.4'),
-            'date versions with 4 bits/earliest year' => array('100000.0.0.0', '100000.0.0.0'),
-            'invalid CalVer (as MAJOR) versions/YYYYMMD' => array('2023013.0.0', '2023013.0.0'),
-            'invalid CalVer (as MAJOR) versions/YYYYMMDDh' => array('202301311.0.0', '202301311.0.0'),
-            'invalid CalVer (as MAJOR) versions/YYYYMMDDhhm' => array('20230131000.0.0', '20230131000.0.0'),
-            'invalid CalVer (as MAJOR) versions/YYYYMMDDhhmmX' => array('2023013100000.0.0', '2023013100000.0.0'),
+            'date versions with 4 bits' => array('20100102.0.3.4'), #, '20100102.0.3.4'),
+            'date versions with 4 bits/earliest year' => array('100000.0.0.0'), #, '100000.0.0.0'),
+            'invalid CalVer (as MAJOR) versions/YYYYMMD' => array('2023013.0.0'), #, '2023013.0.0'),
+            'invalid CalVer (as MAJOR) versions/YYYYMMDDh' => array('202301311.0.0'), #, '202301311.0.0'),
+            'invalid CalVer (as MAJOR) versions/YYYYMMDDhhm' => array('20230131000.0.0'), #, '20230131000.0.0'),
+            'invalid CalVer (as MAJOR) versions/YYYYMMDDhhmmX' => array('2023013100000.0.0'), #, '2023013100000.0.0'),
         );
     }
 
@@ -195,6 +199,7 @@ class VersionParserTest extends TestCase
      * @dataProvider failingNormalizedVersionsWithBadAlias
      * @param string $fullInput
      */
+    #[DataProvider('failingNormalizedVersionsWithBadAlias')]
     public function testNormalizeFailsAndReportsAliasIssue($fullInput)
     {
         if (!preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $fullInput, $match)) {
@@ -227,6 +232,7 @@ class VersionParserTest extends TestCase
      * @dataProvider failingNormalizedVersionsWithBadAliasee
      * @param string $fullInput
      */
+    #[DataProvider('failingNormalizedVersionsWithBadAliasee')]
     public function testNormalizeFailsAndReportsAliaseeIssue($fullInput)
     {
         if (!preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $fullInput, $match)) {
@@ -260,6 +266,7 @@ class VersionParserTest extends TestCase
      * @param string $input
      * @param string $expected
      */
+    #[DataProvider('successfulNormalizedBranches')]
     public function testNormalizeBranch($input, $expected)
     {
         $parser = new VersionParser();
@@ -329,6 +336,7 @@ class VersionParserTest extends TestCase
      * @param string     $input
      * @param Constraint $expected
      */
+    #[DataProvider('simpleConstraints')]
     public function testParseConstraintsSimple($input, $expected)
     {
         $parser = new VersionParser();
@@ -383,6 +391,7 @@ class VersionParserTest extends TestCase
      * @param Constraint|null $min
      * @param Constraint      $max
      */
+    #[DataProvider('wildcardConstraints')]
     public function testParseConstraintsWildcard($input, $min, $max)
     {
         $parser = new VersionParser();
@@ -425,6 +434,7 @@ class VersionParserTest extends TestCase
      * @param Constraint|null $min
      * @param Constraint      $max
      */
+    #[DataProvider('tildeConstraints')]
     public function testParseTildeWildcard($input, $min, $max)
     {
         $parser = new VersionParser();
@@ -472,6 +482,7 @@ class VersionParserTest extends TestCase
      * @param Constraint|null $min
      * @param Constraint      $max
      */
+    #[DataProvider('caretConstraints')]
     public function testParseCaretWildcard($input, $min, $max)
     {
         $parser = new VersionParser();
@@ -522,6 +533,7 @@ class VersionParserTest extends TestCase
      * @param Constraint|null $min
      * @param Constraint      $max
      */
+    #[DataProvider('hyphenConstraints')]
     public function testParseHyphen($input, $min, $max)
     {
         $parser = new VersionParser();
@@ -562,6 +574,7 @@ class VersionParserTest extends TestCase
      * @param string $constraint
      * @param string $expected
      */
+    #[DataProvider('constraintProvider')]
     public function testParseConstraints($constraint, $expected)
     {
         $parser = new VersionParser();
@@ -611,6 +624,7 @@ class VersionParserTest extends TestCase
      * @dataProvider multiConstraintProvider
      * @param string $constraint
      */
+    #[DataProvider('multiConstraintProvider')]
     public function testParseConstraintsMulti($constraint)
     {
         $parser = new VersionParser();
@@ -661,6 +675,7 @@ class VersionParserTest extends TestCase
      *
      * @param string $constraint
      */
+    #[DataProvider('multiConstraintProvider2')]
     public function testParseConstraintsMultiDisjunctiveHasPrioOverConjuctive($constraint)
     {
         $parser = new VersionParser();
@@ -720,6 +735,7 @@ class VersionParserTest extends TestCase
      *
      * @param string $input
      */
+    #[DataProvider('failingConstraints')]
     public function testParseConstraintsFails($input)
     {
         $this->doExpectException('UnexpectedValueException');
@@ -781,6 +797,7 @@ class VersionParserTest extends TestCase
      * @param string $expected
      * @param string $version
      */
+    #[DataProvider('stabilityProvider')]
     public function testParseStability($expected, $version)
     {
         $this->assertSame($expected, VersionParser::parseStability($version));