44
55use RobinIngelbrecht \PHPUnitCoverageTools \MinCoverage \MinCoverageResult ;
66use RobinIngelbrecht \PHPUnitCoverageTools \MinCoverage \ResultStatus ;
7+ use RobinIngelbrecht \PHPUnitCoverageTools \Timer \ResourceUsageFormatter ;
8+ use RobinIngelbrecht \PHPUnitCoverageTools \Timer \SystemResourceUsageFormatter ;
79use SebastianBergmann \Timer \Duration ;
8- use SebastianBergmann \Timer \ResourceUsageFormatter ;
910use Symfony \Component \Console \Formatter \OutputFormatterStyle ;
1011use Symfony \Component \Console \Helper \Table ;
1112use Symfony \Component \Console \Helper \TableCell ;
@@ -18,6 +19,7 @@ final class ConsoleOutput
1819{
1920 public function __construct (
2021 private readonly OutputInterface $ output ,
22+ private readonly ResourceUsageFormatter $ resourceUsageFormatter ,
2123 ) {
2224 $ this ->output ->setDecorated (true );
2325 $ this ->output ->getFormatter ()->setStyle (
@@ -40,7 +42,10 @@ public function __construct(
4042
4143 public static function create (): self
4244 {
43- return new self (new \Symfony \Component \Console \Output \ConsoleOutput ());
45+ return new self (
46+ output: new \Symfony \Component \Console \Output \ConsoleOutput (),
47+ resourceUsageFormatter: SystemResourceUsageFormatter::create ()
48+ );
4449 }
4550
4651 /**
@@ -106,6 +111,6 @@ public function print(array $results, Duration $duration): void
106111 ],
107112 ]);
108113 $ table ->render ();
109- $ this ->output ->writeln (( new ResourceUsageFormatter ()) ->resourceUsage ($ duration ));
114+ $ this ->output ->writeln ($ this -> resourceUsageFormatter ->resourceUsage ($ duration ));
110115 }
111116}
0 commit comments