コード例 #1
0
ファイル: TimerTest.php プロジェクト: xicrow/php-debug
 /**
  * @test
  * @covers \Xicrow\PhpDebug\Timer::reset
  * @covers \Xicrow\PhpDebug\Timer::add
  * @covers \Xicrow\PhpDebug\Timer::custom
  * @covers \Xicrow\PhpDebug\Timer::getStats
  */
 public function testGetStats()
 {
     Timer::reset();
     $expected = 'Unknow item in with key: foo';
     $result = Timer::getStats('foo');
     $this->assertEquals($expected, $result);
     $timerName = 'Foo';
     Timer::custom($timerName, 0.1, 0.2);
     $result = Timer::getStats($timerName);
     $this->assertContains($timerName, $result);
     $this->assertContains('100.0000 MS', $result);
     $timerName = 'Really, really, really, really, really, really, really, really, really, really, really, really, really long timer name';
     Timer::custom($timerName, 0.1, 0.2);
     $result = Timer::getStats($timerName);
     $this->assertContains(substr($timerName, -20), $result);
     $this->assertContains('100.0000 MS', $result);
 }