NullHandlerTest.php 999 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Monolog package.
  4. *
  5. * (c) Jordi Boggiano <j.boggiano@seld.be>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Monolog\Handler;
  11. use Monolog\Logger;
  12. class NullHandlerTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testHandle()
  15. {
  16. $handler = new NullHandler();
  17. $this->assertTrue($handler->handle($this->getRecord()));
  18. }
  19. public function testHandleLowerLevelRecord()
  20. {
  21. $handler = new NullHandler(Logger::WARNING);
  22. $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
  23. }
  24. /**
  25. * No-op test for coverage
  26. */
  27. public function testWrite()
  28. {
  29. $handler = new NullHandler();
  30. $handler->write($this->getRecord());
  31. }
  32. protected function getRecord($level = Logger::WARNING)
  33. {
  34. return array(
  35. 'level' => $level,
  36. );
  37. }
  38. }