File: 0001-Patch-tests-for-PHPUnit-12-support.patch

package info (click to toggle)
php-di-invoker 2.3.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: php: 1,161; makefile: 13; sh: 6
file content (439 lines) | stat: -rw-r--r-- 16,103 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
From: William Desportes <williamdes@wdes.fr>
Date: Sat, 30 Aug 2025 01:41:41 +0200
Subject: Patch tests for PHPUnit 12 support

Origin: vendor
Forwarded: https://github.com/PHP-DI/Invoker/pull/55
---
 tests/CallableResolverTest.php                     | 11 ++++++++
 tests/InvokerTest.php                              | 31 +++++++++++++++++++++-
 .../ParameterNameContainerResolverTest.php         |  3 +++
 .../Container/TypeHintContainerResolverTest.php    |  3 +++
 tests/ParameterResolver/TypeHintResolverTest.php   |  3 +++
 5 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/tests/CallableResolverTest.php b/tests/CallableResolverTest.php
index 26796f6..97b0873 100644
--- a/tests/CallableResolverTest.php
+++ b/tests/CallableResolverTest.php
@@ -27,6 +27,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolves_function()
     {
         $result = $this->resolver->resolve('strlen');
@@ -37,6 +38,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolves_namespaced_function()
     {
         $result = $this->resolver->resolve(__NAMESPACE__ . '\foo');
@@ -47,6 +49,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolves_callable_from_container()
     {
         $callable = function () {
@@ -59,6 +62,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolves_invokable_class()
     {
         $callable = new CallableSpy;
@@ -70,6 +74,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolve_array_method_call()
     {
         $fixture = new InvokerTestFixture;
@@ -84,6 +89,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolve_string_method_call()
     {
         $fixture = new InvokerTestFixture;
@@ -98,6 +104,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolves_array_method_call_with_service()
     {
         $fixture = new InvokerTestFixture;
@@ -112,6 +119,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function resolves_string_method_call_with_service()
     {
         $fixture = new InvokerTestFixture;
@@ -126,6 +134,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function throws_resolving_non_callable_from_container()
     {
         $this->expectExceptionMessage("'foo' is neither a callable nor a valid container entry");
@@ -137,6 +146,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function handles_objects_correctly_in_exception_message()
     {
         $this->expectExceptionMessage('Instance of stdClass is not a callable');
@@ -148,6 +158,7 @@ class CallableResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function handles_method_calls_correctly_in_exception_message()
     {
         $this->expectExceptionMessage('stdClass::test() is not a callable');
diff --git a/tests/InvokerTest.php b/tests/InvokerTest.php
index 4294abd..1633c69 100644
--- a/tests/InvokerTest.php
+++ b/tests/InvokerTest.php
@@ -32,6 +32,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_closure()
     {
         $callable = new CallableSpy;
@@ -44,6 +45,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_method()
     {
         $fixture = new InvokerTestFixture;
@@ -56,6 +58,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function cannot_invoke_unknown_method()
     {
         $this->expectExceptionMessage('Invoker\Test\InvokerTestFixture::bar() is not a callable.');
@@ -66,6 +69,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function cannot_invoke_magic_method()
     {
         $this->expectExceptionMessage('Invoker\Test\InvokerTestMagicMethodFixture::foo() is not a callable. A __call() or __callStatic() method exists but magic methods are not supported.');
@@ -76,6 +80,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function cannot_invoke_static_magic_method()
     {
         $this->expectExceptionMessage('Invoker\Test\InvokerTestStaticMagicMethodFixture::foo() is not a callable. A __call() or __callStatic() method exists but magic methods are not supported.');
@@ -86,6 +91,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_static_method()
     {
         $result = $this->invoker->call([InvokerTestStaticFixture::class, 'foo']);
@@ -96,6 +102,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_static_method_with_scope_resolution_syntax()
     {
         $result = $this->invoker->call('Invoker\Test\InvokerTestStaticFixture::foo');
@@ -106,6 +113,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_return_the_callable_return_value()
     {
         $result = $this->invoker->call(function () {
@@ -118,6 +126,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_no_value_for_parameter()
     {
         $this->expectExceptionMessage('Unable to invoke the callable because no value was given for parameter 2 ($bar)');
@@ -132,6 +141,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_no_value_for_parameter_even_with_trailing_optional_parameters()
     {
         $this->expectExceptionMessage('Unable to invoke the callable because no value was given for parameter 2 ($bar)');
@@ -146,6 +156,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_callable_with_parameters_indexed_by_position()
     {
         $callable = new CallableSpy;
@@ -158,6 +169,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_callable_with_parameters_indexed_by_name()
     {
         $parameters = [
@@ -175,6 +187,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_callable_with_default_value_for_undefined_parameters()
     {
         $parameters = [
@@ -192,6 +205,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_callable_with_null_for_nullable_parameters()
     {
         $result = $this->invoker->call(function (?string $baz = null) {
@@ -238,6 +252,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_do_dependency_injection_with_typehint_container_resolver()
     {
         $resolver = new TypeHintContainerResolver($this->container);
@@ -256,6 +271,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_do_dependency_injection_with_parameter_name_container_resolver()
     {
         $resolver = new ParameterNameContainerResolver($this->container);
@@ -274,6 +290,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_callable_from_container()
     {
         $callable = new CallableSpy;
@@ -287,6 +304,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_array_callable_from_container()
     {
         $fixture = new InvokerTestFixture;
@@ -301,6 +319,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_callable_from_container_with_scope_resolution_syntax()
     {
         $fixture = new InvokerTestFixture;
@@ -315,6 +334,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_array_callable_from_container_with_class_name()
     {
         $fixture = new InvokerTestFixture;
@@ -329,6 +349,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_callable_from_container_with_class_name_in_scope_resolution_syntax()
     {
         $fixture = new InvokerTestFixture;
@@ -366,6 +387,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_not_invoke_statically_a_non_static_method()
     {
         $this->expectExceptionMessage('Cannot call foo() on Invoker\Test\InvokerTestFixture because it is not a class nor a valid container entry');
@@ -376,6 +398,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_calling_non_callable_without_container()
     {
         $this->expectExceptionMessage("'foo' is not a callable");
@@ -387,6 +410,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_calling_non_callable_without_container_2()
     {
         $this->expectExceptionMessage('NULL is not a callable');
@@ -398,6 +422,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_calling_non_callable_with_container()
     {
         $this->expectExceptionMessage("'foo' is neither a callable nor a valid container entry");
@@ -409,6 +434,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_calling_non_callable_object()
     {
         $this->expectExceptionMessage('Instance of stdClass is not a callable');
@@ -420,6 +446,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_static_method_rather_than_resolving_entry_from_container()
     {
         // Register a non-callable so that test fails if we try to invoke that
@@ -434,6 +461,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_no_value_for_optional_parameter_1()
     {
         $this->expectExceptionMessage('Unable to invoke the callable because no value was given for parameter 2 ($bar)');
@@ -449,6 +477,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_throw_if_no_value_for_optional_parameter_2()
     {
         $this->expectExceptionMessage('Unable to invoke the callable because no value was given for parameter 2 ($bar)');
@@ -465,6 +494,7 @@ class InvokerTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_invoke_callable_with_variadic_parameter()
     {
         $callable = function (...$param) {
@@ -533,4 +563,3 @@ class InvokerTestStaticMagicMethodFixture
         throw new Exception('Unknown method');
     }
 }
-
diff --git a/tests/ParameterResolver/Container/ParameterNameContainerResolverTest.php b/tests/ParameterResolver/Container/ParameterNameContainerResolverTest.php
index e18f430..51af9ad 100644
--- a/tests/ParameterResolver/Container/ParameterNameContainerResolverTest.php
+++ b/tests/ParameterResolver/Container/ParameterNameContainerResolverTest.php
@@ -23,6 +23,7 @@ class ParameterNameContainerResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_parameter_with_parameter_name_from_container()
     {
         $callable = function ($foo) {
@@ -40,6 +41,7 @@ class ParameterNameContainerResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_skip_parameter_if_container_cannot_provide_parameter()
     {
         $callable = function ($foo) {
@@ -54,6 +56,7 @@ class ParameterNameContainerResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_skip_parameter_if_already_resolved()
     {
         $callable = function ($foo) {
diff --git a/tests/ParameterResolver/Container/TypeHintContainerResolverTest.php b/tests/ParameterResolver/Container/TypeHintContainerResolverTest.php
index 3f849f6..bdc9424 100644
--- a/tests/ParameterResolver/Container/TypeHintContainerResolverTest.php
+++ b/tests/ParameterResolver/Container/TypeHintContainerResolverTest.php
@@ -25,6 +25,7 @@ class TypeHintContainerResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_parameter_with_typehint_and_container()
     {
         $callable = function (TypeHintContainerResolverFixture $foo, self $bar) {
@@ -45,6 +46,7 @@ class TypeHintContainerResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_skip_parameter_if_container_cannot_provide_typehint()
     {
         $callable = function (TypeHintContainerResolverFixture $foo) {
@@ -59,6 +61,7 @@ class TypeHintContainerResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_skip_parameter_if_already_resolved()
     {
         $callable = function (TypeHintContainerResolverFixture $foo) {
diff --git a/tests/ParameterResolver/TypeHintResolverTest.php b/tests/ParameterResolver/TypeHintResolverTest.php
index a0f980e..54ac8ff 100644
--- a/tests/ParameterResolver/TypeHintResolverTest.php
+++ b/tests/ParameterResolver/TypeHintResolverTest.php
@@ -20,6 +20,7 @@ class TypeHintResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_resolve_parameter_with_typehint()
     {
         $callable = function (TypeHintResolverFixture $foo, self $bar) {
@@ -41,6 +42,7 @@ class TypeHintResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_skip_parameter_if_provided_parameters_do_not_contain_typehint()
     {
         $callable = function (TypeHintResolverFixture $foo) {
@@ -55,6 +57,7 @@ class TypeHintResolverTest extends TestCase
     /**
      * @test
      */
+    #[\PHPUnit\Framework\Attributes\Test]
     public function should_skip_parameter_if_already_resolved()
     {
         $callable = function (TypeHintResolverFixture $foo) {