コード例 #1
0
 /**
  * Tests whether logException() works as expected.
  *
  * @return void
  */
 public function testLogException()
 {
     $logFile = new File(ABLERON_LOG_DIR . '/LogManagerTest-testLogException.log');
     $logManager = new LogManager(new FileLogger($logFile));
     $exception = new SystemException('Message', 0, E_USER_WARNING, 'foo.php', 42, new Exception('Foo bar'));
     $logManager->logException('Test exception', $exception);
     $logFileEntry = $logFile->getContent();
     $this->assertStringMatchesFormat('%d-%d-%d %d:%d:%d WARNING Test exception%cException: Message in file foo.php on line 42%c#%d%a', $logFileEntry);
     $this->assertContains('Previous:', $logFileEntry);
     $this->assertContains('Foo bar', $logFileEntry);
 }