Skip to content

Commit 1687f64

Browse files
authored
Fix time collector logic when debugging (Codeception#77)
1 parent 32ebb7a commit 1687f64

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Symfony\Component\HttpFoundation\Session\SessionInterface;
3030
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
3131
use Symfony\Component\HttpKernel\DataCollector\EventDataCollector;
32+
use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector;
3233
use Symfony\Component\HttpKernel\Kernel;
3334
use Symfony\Component\HttpKernel\Profiler\Profile;
3435
use Symfony\Component\HttpKernel\Profiler\Profiler;
@@ -743,6 +744,8 @@ protected function grabCollector(string $collector, string $function, ?string $m
743744
}
744745

745746
/**
747+
* Set the data that will be displayed when running a test with the `--debug` flag
748+
*
746749
* @param $url
747750
*/
748751
protected function debugResponse($url): void
@@ -780,8 +783,11 @@ protected function debugResponse($url): void
780783
if (isset($emails)) {
781784
$this->debugSection('Emails', $emails . ' sent');
782785
}
783-
if ($profile->hasCollector('timer')) {
784-
$this->debugSection('Time', $profile->getCollector('timer')->getTime());
786+
if ($profile->hasCollector('time')) {
787+
/** @var TimeDataCollector $timeCollector */
788+
$timeCollector = $profile->getCollector('time');
789+
$duration = number_format($timeCollector->getDuration(), 2) . ' ms';
790+
$this->debugSection('Time', $duration);
785791
}
786792
}
787793

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy