public function testGetLocationInformation() { $hierarchy = Logger::getHierarchy(); $root = $hierarchy->getRootLogger(); $a = new LoggerLoggingEventTestCaseAppender('A1'); $a->setLayout(new LoggerLoggingEventTestCaseLayout()); $root->addAppender($a); $logger = $hierarchy->getLogger('test'); $line = __LINE__; $logger->debug('test'); $hierarchy->shutdown(); $li = self::$locationInfo; self::assertEquals($li->getClassName(), get_class($this)); self::assertEquals($li->getFileName(), __FILE__); self::assertEquals($li->getLineNumber(), $line); self::assertEquals($li->getMethodName(), __FUNCTION__); }
public function testGetThrowableInformation2() { $hierarchy = Logger::getHierarchy(); $root = $hierarchy->getRootLogger(); $a = new LoggerLoggingEventTestCaseAppender('A1'); $a->setLayout(new LoggerLoggingEventTestCaseLayout()); $root->addAppender($a); $ex = new Exception('Message1'); $logger = $hierarchy->getLogger('test'); $logger->debug('test', $ex); $hierarchy->shutdown(); $ti = self::$throwableInfo; self::assertTrue($ti instanceof LoggerThrowableInformation); $result = $ti->getStringRepresentation(); self::assertInternalType('array', $result); }