Ejemplo n.º 1
0
 /**
  * Common testcase constructor parts.
  *
  * @return void
  */
 private function setUpCommon()
 {
     $this->reflection = new ReflectionClass('Lunr\\Ticks\\FileTimer');
     $this->file = $this->getMockBuilder('\\SplFileObject')->setConstructorArgs([tempnam('/tmp', 'tick')])->getMock();
     $this->datetime = $this->getMock('Lunr\\Core\\DateTime');
     $this->datetime->expects($this->once())->method('set_datetime_format')->with('%Y-%m-%d %H:%M:%S');
 }
Ejemplo n.º 2
0
 /**
  * Test that log() returns a string when an object is passed as message.
  *
  * @covers Lunr\Feedback\PHPLogger::log
  */
 public function testLogReturnsStringWhenObjectPassedAsMessage()
 {
     $object = new MockLogMessage();
     $this->datetime->expects($this->once())->method('get_datetime')->will($this->returnValue(self::DATETIME_STRING));
     $this->fao->expects($this->once())->method('put_file_content')->with($this->equalTo($this->filename), $this->equalTo("[2011-11-10 10:30:22]: WARNING: Foo\n"), $this->equalTo(TRUE));
     $this->class->log(LogLevel::WARNING, $object);
 }