getAll() public static method

Calculates elapsed time for each timer. If clear is true, will delete existing timers
public static getAll ( boolean $clear = false ) : array
$clear boolean false
return array
 /**
  * Test save timers
  *
  * @return void
  */
 public function testSaveTimers()
 {
     $timers = DebugTimer::getAll();
     $this->assertEquals(count($timers), 1);
     $article = $this->Article->newEntity(['user_id' => 1, 'title' => 'test', 'body' => 'test']);
     $this->Article->save($article);
     $result = DebugTimer::getAll();
     $this->assertEquals(count($result), 2);
 }
 /**
  * Test that methods are proxied.
  *
  * @return void
  */
 public function testProxyMethodsTimers()
 {
     $this->engine->read('key');
     $this->engine->write('key', 'value');
     $this->engine->delete('key');
     $this->engine->increment('key');
     $this->engine->decrement('key');
     $result = DebugTimer::getAll();
     $this->assertCount(6, $result);
     $this->assertArrayHasKey('Cache.read key', $result);
     $this->assertArrayHasKey('Cache.write key', $result);
     $this->assertArrayHasKey('Cache.delete key', $result);
     $this->assertArrayHasKey('Cache.increment key', $result);
     $this->assertArrayHasKey('Cache.decrement key', $result);
 }
Beispiel #3
0
 /**
  * Get the data for the panel.
  *
  * @return array
  */
 public function data()
 {
     return ['requestTime' => DebugTimer::requestTime(), 'timers' => DebugTimer::getAll(), 'memory' => DebugMemory::getAll(), 'peakMemory' => DebugMemory::getPeak()];
 }
Beispiel #4
0
 /**
  * test getting all the set timers.
  *
  * @return void
  */
 public function testGetTimers()
 {
     DebugTimer::start('test1', 'this is my first test');
     DebugTimer::stop('test1');
     usleep(50);
     DebugTimer::start('test2');
     DebugTimer::stop('test2');
     $timers = DebugTimer::getAll();
     $this->assertEquals(3, count($timers));
     $this->assertTrue(is_float($timers['test1']['time']));
     $this->assertTrue(isset($timers['test1']['message']));
     $this->assertTrue(isset($timers['test2']['message']));
 }