public function testFatal() { $end = $this->end; $this->mockFunction('microtime', function () use($end) { return $end; }); /** @var \PHPUnit_Framework_MockObject_MockObject|Logger $mock */ $mock = $this->getMockBuilder(Logger::class)->setConstructorArgs(['logger'])->setMethods(['log'])->getMock(); $mock->expects($this->once())->method('log')->with($this->equalTo(Logger::FATAL), $this->equalTo("hello {$this->start} {$this->end} {$this->time}")); $timer = new LoggerTimer($mock, $this->start); $timer->fatal('hello {start} {end} {time}'); }
public function testFatal() { $end = $this->end; $this->mockFunction('microtime', function () use($end) { return $end; }); $mock = $this->getMockBuilder('Logger')->setConstructorArgs(array('logger'))->setMethods(array('log'))->getMock(); $mock->expects($this->once())->method('log')->with($this->equalTo(Logger::FATAL), $this->equalTo("hello {$this->start} {$this->end} {$this->time}")); $timer = new LoggerTimer($mock, $this->start); $timer->fatal("hello {start} {end} {time}"); }