25 public $timestamp = 3.1415926;
26 public function getTimestamp()
28 return $this->timestamp;
36 protected function setUp()
38 $this->logger = M::mock(
'Monolog\Logger');
39 $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
42 protected function tearDown()
44 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
48 public function testTicToc()
54 $expected = sprintf(
"%s (%.3fms)", $text, ($endTime - $startTime) * 1000);
55 $this->logger->shouldReceive(
'debug')->with($expected);
56 $hackedTimingLogger->timestamp = $startTime;
57 $hackedTimingLogger->tic();
58 $hackedTimingLogger->timestamp = $endTime;
59 $hackedTimingLogger->toc($text);
62 public function testTicTocOtherWatch()
68 $watch =
'otherWatch';
69 $expected = sprintf(
"%s (%.3fms)", $text, ($endTime - $startTime) * 1000);
70 $this->logger->shouldReceive(
'debug')->with($expected);
71 $hackedTimingLogger->timestamp = $startTime;
72 $hackedTimingLogger->tic($watch);
73 $hackedTimingLogger->timestamp = ($startTime+$endTime)/2;
74 $hackedTimingLogger->tic(
'default');
75 $hackedTimingLogger->timestamp = $endTime;
76 $hackedTimingLogger->toc($text,$watch);