/** * @dataProvider providerPrettyFormat */ public function testPrettyFormat($values, $expected) { $dateInterval = new DateIntervalExtended($values['interval'], $values['ms']); $this->assertEquals($expected, $dateInterval->prettyFormat()); }
protected function formatStopwatchEvent($eventName, StopwatchEvent $event, OutputInterface $output, $withMemoryUsage = false) { $duration = new DateIntervalExtended('PT0S', $event->getDuration()); if ($eventName == 'total') { $output->write('<info>Total (Full processing)</info> : '); } else { $output->write($eventName . ' : '); } $output->writeln('<comment>' . $duration->prettyFormat() . '</comment>'); if ($withMemoryUsage) { $output->writeln('Memory usage : <comment>' . Memory::convert($event->getMemory()) . '</comment>'); } }