public function testInfo()
 {
     $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::INFO), $this->equalTo("hello {$this->start} {$this->end} {$this->time}"));
     $timer = new LoggerTimer($mock, $this->start);
     $timer->info("hello {start} {end} {time}");
 }
예제 #2
0
 public function testInfo()
 {
     $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::INFO), $this->equalTo("hello {$this->start} {$this->end} {$this->time}"));
     $timer = new LoggerTimer($mock, $this->start);
     $timer->info('hello {start} {end} {time}');
 }