/** * Testcase Constructor. * * @return void */ public function setUpDateTime() { $this->request = $this->getMock('Lunr\\Corona\\RequestInterface'); $this->datetime = $this->getMock('Lunr\\Core\\DateTime'); $this->datetime->expects($this->once())->method('set_datetime_format')->with($this->equalTo('%Y-%m-%d %H:%M:%S')); $this->class = $this->getMockBuilder('Lunr\\Feedback\\AbstractLogger')->setConstructorArgs([$this->request, $this->datetime])->getMockForAbstractClass(); $this->reflection = new ReflectionClass('Lunr\\Feedback\\AbstractLogger'); }
/** * Compose a timestamped message string. * * @param String $message Base message with placeholders * @param array $context Additional meta-information for the log * * @return String $msg Log Message String */ protected function compose_timestamped_message($message, $context) { $prefix = ''; if ($this->datetime !== NULL) { $prefix .= '[' . $this->datetime->get_datetime() . ']: '; } return $prefix . $this->compose_message($message, $context); }