Skip to content

Commit 9f3967c

Browse files
Make it possible to create TestMethod object when calling TestDoxBuilder::fromTestCase() would error
1 parent 0e642c6 commit 9f3967c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Event/Value/Test/TestMethodBuilder.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,23 @@
2626
*/
2727
final readonly class TestMethodBuilder
2828
{
29-
public static function fromTestCase(TestCase $testCase): TestMethod
29+
public static function fromTestCase(TestCase $testCase, bool $useTestCaseForTestDox = true): TestMethod
3030
{
3131
$methodName = $testCase->name();
3232
$location = Reflection::sourceLocationFor($testCase::class, $methodName);
3333

34+
if ($useTestCaseForTestDox) {
35+
$testDox = TestDoxBuilder::fromTestCase($testCase);
36+
} else {
37+
$testDox = TestDoxBuilder::fromClassNameAndMethodName($testCase::class, $testCase->name());
38+
}
39+
3440
return new TestMethod(
3541
$testCase::class,
3642
$methodName,
3743
$location['file'],
3844
$location['line'],
39-
TestDoxBuilder::fromTestCase($testCase),
45+
$testDox,
4046
MetadataRegistry::parser()->forClassAndMethod($testCase::class, $methodName),
4147
self::dataFor($testCase),
4248
);

0 commit comments

Comments
 (0)