@@ -160,7 +160,7 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
160
160
/**
161
161
* @psalm-var non-empty-string
162
162
*/
163
- private string $ name ;
163
+ private string $ methodName ;
164
164
165
165
/**
166
166
* @psalm-var list<string>
@@ -225,9 +225,12 @@ abstract class TestCase extends Assert implements Reorderable, SelfDescribing, T
225
225
*/
226
226
public function __construct (string $ name )
227
227
{
228
- $ this ->setName ($ name );
228
+ $ this ->methodName = $ name ;
229
+ $ this ->status = TestStatus::unknown ();
229
230
230
- $ this ->status = TestStatus::unknown ();
231
+ if (is_callable ($ this ->sortId (), true )) {
232
+ $ this ->providedTests = [new ExecutionOrderDependency ($ this ->sortId ())];
233
+ }
231
234
}
232
235
233
236
/**
@@ -288,7 +291,7 @@ public function toString(): string
288
291
$ buffer = sprintf (
289
292
'%s::%s ' ,
290
293
(new ReflectionClass ($ this ))->getName (),
291
- $ this ->name ,
294
+ $ this ->methodName ,
292
295
);
293
296
294
297
return $ buffer . $ this ->dataSetAsStringWithData ();
@@ -362,7 +365,7 @@ final public function setGroups(array $groups): void
362
365
*/
363
366
final public function nameWithDataSet (): string
364
367
{
365
- return $ this ->name . $ this ->dataSetAsString ();
368
+ return $ this ->methodName . $ this ->dataSetAsString ();
366
369
}
367
370
368
371
/**
@@ -372,7 +375,7 @@ final public function nameWithDataSet(): string
372
375
*/
373
376
final public function name (): string
374
377
{
375
- return $ this ->name ;
378
+ return $ this ->methodName ;
376
379
}
377
380
378
381
/**
@@ -382,7 +385,7 @@ final public function size(): TestSize
382
385
{
383
386
return (new Groups )->size (
384
387
static ::class,
385
- $ this ->name ,
388
+ $ this ->methodName ,
386
389
);
387
390
}
388
391
@@ -463,8 +466,8 @@ final public function runBare(): void
463
466
$ this ->invokeBeforeClassHookMethods ($ hookMethods , $ emitter );
464
467
}
465
468
466
- if (method_exists (static ::class, $ this ->name ) &&
467
- MetadataRegistry::parser ()->forClassAndMethod (static ::class, $ this ->name )->isDoesNotPerformAssertions ()->isNotEmpty ()) {
469
+ if (method_exists (static ::class, $ this ->methodName ) &&
470
+ MetadataRegistry::parser ()->forClassAndMethod (static ::class, $ this ->methodName )->isDoesNotPerformAssertions ()->isNotEmpty ()) {
468
471
$ this ->doesNotPerformAssertions = true ;
469
472
}
470
473
@@ -622,20 +625,6 @@ final public function runBare(): void
622
625
}
623
626
}
624
627
625
- /**
626
- * @psalm-param non-empty-string $name
627
- *
628
- * @internal This method is not covered by the backward compatibility promise for PHPUnit
629
- */
630
- final public function setName (string $ name ): void
631
- {
632
- $ this ->name = $ name ;
633
-
634
- if (is_callable ($ this ->sortId (), true )) {
635
- $ this ->providedTests = [new ExecutionOrderDependency ($ this ->sortId ())];
636
- }
637
- }
638
-
639
628
/**
640
629
* @psalm-param list<ExecutionOrderDependency> $dependencies
641
630
*
@@ -848,7 +837,7 @@ final public function providedData(): array
848
837
*/
849
838
final public function sortId (): string
850
839
{
851
- $ id = $ this ->name ;
840
+ $ id = $ this ->methodName ;
852
841
853
842
if (!str_contains ($ id , ':: ' )) {
854
843
$ id = static ::class . ':: ' . $ id ;
@@ -1181,7 +1170,7 @@ final protected function runTest(): mixed
1181
1170
$ testArguments = array_merge ($ this ->data , array_values ($ this ->dependencyInput ));
1182
1171
1183
1172
try {
1184
- $ testResult = $ this ->{$ this ->name }(...$ testArguments );
1173
+ $ testResult = $ this ->{$ this ->methodName }(...$ testArguments );
1185
1174
} catch (Throwable $ exception ) {
1186
1175
if (!$ this ->shouldExceptionExpectationsBeVerified ($ exception )) {
1187
1176
throw $ exception ;
@@ -1665,13 +1654,13 @@ private function verifyMockObjects(): void
1665
1654
*/
1666
1655
private function checkRequirements (): void
1667
1656
{
1668
- if (!$ this ->name || !method_exists ($ this , $ this ->name )) {
1657
+ if (!$ this ->methodName || !method_exists ($ this , $ this ->methodName )) {
1669
1658
return ;
1670
1659
}
1671
1660
1672
1661
$ missingRequirements = (new Requirements )->requirementsNotSatisfiedFor (
1673
1662
static ::class,
1674
- $ this ->name ,
1663
+ $ this ->methodName ,
1675
1664
);
1676
1665
1677
1666
if (!empty ($ missingRequirements )) {
0 commit comments