Skip to content

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Mar 12, 2024
1 parent c7d0177 commit 52e170f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/Event/Value/Test/TestDoxBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@
*/
final readonly class TestDoxBuilder
{
public static function fromTestCase(TestCase $testCase): TestDox
public static function fromTestCase(TestCase $testCase, bool $colorize): TestDox
{
$prettifier = new NamePrettifier;

$prettyTestCase = $prettifier->prettifyTestCase($testCase, false);

if ($colorize) {
$prettyTestCaseColorized = $prettifier->prettifyTestCase($testCase, true);
} else {
$prettyTestCaseColorized = $prettyTestCase;
}

return new TestDox(

Check failure on line 32 in src/Event/Value/Test/TestDoxBuilder.php

View workflow job for this annotation

GitHub Actions / Type Checker

TooManyArguments

src/Event/Value/Test/TestDoxBuilder.php:32:16: TooManyArguments: Too many arguments for PHPUnit\Event\Code\TestDox::__construct - expecting 2 but saw 3 (see https://psalm.dev/026)
$prettifier->prettifyTestClassName($testCase::class),
$prettifier->prettifyTestCase($testCase, false),
$prettyTestCase,
$prettyTestCaseColorized
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/Event/Value/Test/TestMethodBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
namespace PHPUnit\Event\Code;

use PHPUnit\TextUI\Configuration\Registry;
use function assert;
use function debug_backtrace;
use function is_numeric;
Expand All @@ -32,13 +33,14 @@ public static function fromTestCase(TestCase $testCase): TestMethod
assert(!empty($methodName));

$location = Reflection::sourceLocationFor($testCase::class, $methodName);
$colors = Registry::get()->colors();

return new TestMethod(
$testCase::class,
$methodName,
$location['file'],
$location['line'],
TestDoxBuilder::fromTestCase($testCase),
TestDoxBuilder::fromTestCase($testCase, $colors),
MetadataRegistry::parser()->forClassAndMethod($testCase::class, $methodName),
self::dataFor($testCase),
);
Expand Down

0 comments on commit 52e170f

Please sign in to comment.