From 410a9de6ae5cf361ea9d559b19d561e9566942ba Mon Sep 17 00:00:00 2001 From: Tavo Nieves J Date: Fri, 11 Dec 2020 22:02:33 -0500 Subject: [PATCH] fix time logic when debugging --- src/Codeception/Module/Symfony.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Codeception/Module/Symfony.php b/src/Codeception/Module/Symfony.php index 272b8c66..4d17ac49 100644 --- a/src/Codeception/Module/Symfony.php +++ b/src/Codeception/Module/Symfony.php @@ -29,6 +29,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; use Symfony\Component\HttpKernel\DataCollector\EventDataCollector; +use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Profiler\Profile; use Symfony\Component\HttpKernel\Profiler\Profiler; @@ -743,6 +744,8 @@ protected function grabCollector(string $collector, string $function, ?string $m } /** + * Set the data that will be displayed when running a test with the `--debug` flag + * * @param $url */ protected function debugResponse($url): void @@ -780,8 +783,11 @@ protected function debugResponse($url): void if (isset($emails)) { $this->debugSection('Emails', $emails . ' sent'); } - if ($profile->hasCollector('timer')) { - $this->debugSection('Time', $profile->getCollector('timer')->getTime()); + if ($profile->hasCollector('time')) { + /** @var TimeDataCollector $timeCollector */ + $timeCollector = $profile->getCollector('time'); + $duration = number_format($timeCollector->getDuration(), 2) . ' ms'; + $this->debugSection('Time', $duration); } }