NoopHandlerTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php declare(strict_types=1);
  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\Test\TestCase;
  12. use Monolog\Logger;
  13. /**
  14. * @covers Monolog\Handler\NoopHandler::handle
  15. */
  16. class NoopHandlerTest extends TestCase
  17. {
  18. /**
  19. * @dataProvider logLevelsProvider
  20. */
  21. public function testIsHandling($level)
  22. {
  23. $handler = new NoopHandler();
  24. $this->assertTrue($handler->isHandling($this->getRecord($level)));
  25. }
  26. /**
  27. * @dataProvider logLevelsProvider
  28. */
  29. public function testHandle($level)
  30. {
  31. $handler = new NoopHandler();
  32. $this->assertFalse($handler->handle($this->getRecord($level)));
  33. }
  34. public function logLevelsProvider()
  35. {
  36. return array_map(
  37. function ($level) {
  38. return [$level];
  39. },
  40. array_values(Logger::getLevels())
  41. );
  42. }
  43. }