1
0

LoggerTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace Osinet\ClassGrapher\Tests;
  3. require_once 'Osinet/ClassGrapher/Logger.php';
  4. require_once 'PHPUnit/Framework/TestCase.php';
  5. /**
  6. * Logger test case.
  7. */
  8. class LoggerTest extends \PHPUnit_Framework_TestCase {
  9. /**
  10. *
  11. * @var Logger
  12. */
  13. private $Logger;
  14. /**
  15. * Prepares the environment before running a test.
  16. */
  17. protected function setUp() {
  18. parent::setUp();
  19. $this->Logger = new Logger();
  20. }
  21. /**
  22. * Cleans up the environment after running a test.
  23. */
  24. protected function tearDown() {
  25. $this->Logger = null;
  26. parent::tearDown();
  27. }
  28. /**
  29. * Tests Logger->__construct()
  30. */
  31. public function test__construct() {
  32. $this->Logger->__construct(LOG_DEBUG);
  33. $this->assertEquals($this->Logger->debugLevel(), LOG_DEBUG);
  34. $this->Logger->__construct(LOG_EMERG - 1);
  35. $this->assertEquals($this->Logger->debugLevel(), LOG_EMERG);
  36. $this->Logger->__construct(LOG_DEBUG + 1);
  37. $this->assertEquals($this->Logger->debugLevel(), LOG_DEBUG);
  38. $this->Logger->__construct();
  39. $this->assertEquals($this->Logger->debugLevel(), LOG_WARNING);
  40. }
  41. public function testDebugLevel() {
  42. $this->assertEquals(LOG_WARNING, $this->Logger->debugLevel());
  43. $level = $this->Logger->debugLevel(LOG_EMERG);
  44. $this->assertEquals(LOG_WARNING, $level);
  45. $level = $this->Logger->debugLevel();
  46. $this->assertEquals(LOG_EMERG, $level);
  47. }
  48. /**
  49. * Tests Logger->debug()
  50. */
  51. public function testDebug() {
  52. $this->markTestSkipped("STDERR capture not available. Cannot test.");
  53. }
  54. }