PageRenderTime 515ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/unit/library/Msd/LogTest.php

https://github.com/BugBuster1701/MySQLDumper
PHP | 64 lines | 53 code | 8 blank | 3 comment | 0 complexity | 1cc307a524c504c67067a2f6798a63f1 MD5 | raw file
  1. <?php
  2. /**
  3. * @group Log
  4. */
  5. class Msd_LogTest extends PHPUnit_Framework_TestCase
  6. {
  7. public function testCanGetLogger()
  8. {
  9. $logger = new Msd_Log();
  10. $this->assertInstanceof('Msd_Log', $logger);
  11. }
  12. public function testCanGetFilePathOfLoggerType()
  13. {
  14. $logger = new Msd_Log();
  15. $this->assertInstanceof('Msd_Log', $logger);
  16. $logPath = $logger->getFile(Msd_Log::PHP);
  17. $this->assertEquals(WORK_PATH . '/log/php.log', $logPath);
  18. $logPath = $logger->getFile(Msd_Log::PERL);
  19. $this->assertEquals(WORK_PATH . '/log/perl.log', $logPath);
  20. $logPath = $logger->getFile(Msd_Log::PERL_COMPLETE);
  21. $this->assertEquals(WORK_PATH . '/log/perlComplete.log', $logPath);
  22. $logPath = $logger->getFile(Msd_Log::ERROR);
  23. $this->assertEquals(WORK_PATH . '/log/phpError.log', $logPath);
  24. }
  25. public function testCanGetLoggerOfGivenType()
  26. {
  27. $logger = new Msd_Log();
  28. $this->assertInstanceof('Msd_Log', $logger);
  29. $loggerTypes = array(
  30. Msd_Log::PHP => WORK_PATH . '/log/php.log',
  31. Msd_Log::PERL => WORK_PATH . '/log/perl.log',
  32. Msd_Log::PERL_COMPLETE => WORK_PATH . '/log/perlComplete.log',
  33. Msd_Log::ERROR => WORK_PATH . '/log/phpError.log',
  34. );
  35. foreach ($loggerTypes as $logType => $logPath) {
  36. $this->assertInstanceof('Zend_Log', $logger->getLogInstance($logType));
  37. $this->assertEquals($logger->getFile($logType), $logPath);
  38. }
  39. }
  40. public function testClosesFileHandlesOnDestroy()
  41. {
  42. $logger = new Msd_Log();
  43. $this->assertInstanceof('Msd_Log', $logger);
  44. $loggerTypes = array(
  45. Msd_Log::PHP => WORK_PATH . '/log/php.log',
  46. Msd_Log::PERL => WORK_PATH . '/log/perl.log',
  47. Msd_Log::PERL_COMPLETE => WORK_PATH . '/log/perlComplete.log',
  48. Msd_Log::ERROR => WORK_PATH . '/log/phpError.log',
  49. );
  50. foreach ($loggerTypes as $logType => $logPath) {
  51. $this->assertInstanceof('Zend_Log', $logger->getLogInstance($logType));
  52. $this->assertEquals($logger->getFile($logType), $logPath);
  53. }
  54. unset($logger);
  55. }
  56. }