Dieser Commit ist enthalten in:
Ursprung
2b21070b1a
Commit
f7a7c71f86
1583 geänderte Dateien mit 454759 neuen und 0 gelöschten Zeilen
71
tests/unit/library/Msd/LogTest.php
Normale Datei
71
tests/unit/library/Msd/LogTest.php
Normale Datei
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* @group Log
|
||||
*/
|
||||
class Msd_LogTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCanGetLogger()
|
||||
{
|
||||
$logger = new Msd_Log();
|
||||
$this->assertInstanceof('Msd_Log', $logger);
|
||||
}
|
||||
|
||||
public function testCanGetFilePathOfLoggerType()
|
||||
{
|
||||
$logger = new Msd_Log();
|
||||
$this->assertInstanceof('Msd_Log', $logger);
|
||||
|
||||
$logPath = $logger->getFile(Msd_Log::PHP);
|
||||
$this->assertEquals(WORK_PATH . '/log/php.log', $logPath);
|
||||
|
||||
$logPath = $logger->getFile(Msd_Log::PERL);
|
||||
$this->assertEquals(WORK_PATH . '/log/perl.log', $logPath);
|
||||
|
||||
$logPath = $logger->getFile(Msd_Log::PERL_COMPLETE);
|
||||
$this->assertEquals(WORK_PATH . '/log/perlComplete.log', $logPath);
|
||||
|
||||
$logPath = $logger->getFile(Msd_Log::ERROR);
|
||||
$this->assertEquals(WORK_PATH . '/log/phpError.log', $logPath);
|
||||
}
|
||||
|
||||
public function testCanGetLoggerOfGivenType()
|
||||
{
|
||||
$logger = new Msd_Log();
|
||||
$this->assertInstanceof('Msd_Log', $logger);
|
||||
$loggerTypes = array(
|
||||
Msd_Log::PHP => WORK_PATH . '/log/php.log',
|
||||
Msd_Log::PERL => WORK_PATH . '/log/perl.log',
|
||||
Msd_Log::PERL_COMPLETE => WORK_PATH . '/log/perlComplete.log',
|
||||
Msd_Log::ERROR => WORK_PATH . '/log/phpError.log',
|
||||
);
|
||||
foreach ($loggerTypes as $logType => $logPath) {
|
||||
$this->assertInstanceof('Zend_Log', $logger->getLogInstance($logType));
|
||||
$this->assertEquals($logger->getFile($logType), $logPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function testClosesFileHandlesOnDestroy()
|
||||
{
|
||||
$logger = new Msd_Log();
|
||||
$this->assertInstanceof('Msd_Log', $logger);
|
||||
$loggerTypes = array(
|
||||
Msd_Log::PHP => WORK_PATH . '/log/php.log',
|
||||
Msd_Log::PERL => WORK_PATH . '/log/perl.log',
|
||||
Msd_Log::PERL_COMPLETE => WORK_PATH . '/log/perlComplete.log',
|
||||
Msd_Log::ERROR => WORK_PATH . '/log/phpError.log',
|
||||
);
|
||||
foreach ($loggerTypes as $logType => $logPath) {
|
||||
$this->assertInstanceof('Zend_Log', $logger->getLogInstance($logType));
|
||||
$this->assertEquals($logger->getFile($logType), $logPath);
|
||||
}
|
||||
unset($logger);
|
||||
}
|
||||
|
||||
public function testCanWriteToLogFile()
|
||||
{
|
||||
$res = Msd_Log::write(Msd_Log::PHP, 'test message');
|
||||
|
||||
print_r($res);
|
||||
}
|
||||
}
|
||||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren