*/
private $rendertime;
+ /**
+ * True, if the Profiler should measure the whole rendertime including functions
+ *
+ * @return bool
+ */
+ public function isRendertime()
+ {
+ return $this->rendertime;
+ }
+
/**
* @param bool $enabled True, if the Profiler is enabled
* @param bool $renderTime True, if the Profiler should measure the whole rendertime including functions
]
);
- $output = $this->getRendertimeString();
- $logger->info($message . ": " . $output, ['action' => 'profiling']);
+ if ($this->isRendertime()) {
+ $output = $this->getRendertimeString();
+ $logger->info($message . ": " . $output, ['action' => 'profiling']);
+ }
}
/**
}
$profiler->saveLog($this->logger, 'test');
+
+ $output = $profiler->getRendertimeString();
+
+ foreach ($data as $perf => $items) {
+ foreach ($items['functions'] as $function) {
+ // assert that the output contains the functions
+ $this->assertRegExp('/' . $function . ': \d+/', $output);
+ }
+ }
+ }
+
+ /**
+ * Test if no rendertime is set
+ */
+ public function testNoRenderTime()
+ {
+ $profiler = new Profiler(true, false);
+
+ $this->assertFalse($profiler->isRendertime());
+ self::assertEmpty($profiler->getRendertimeString());
}
}