2
0

NoopHandlerTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\Level;
  12. use PHPUnit\Framework\Attributes\DataProvider;
  13. /**
  14. * @covers Monolog\Handler\NoopHandler::handle
  15. */
  16. class NoopHandlerTest extends \Monolog\Test\MonologTestCase
  17. {
  18. #[DataProvider('logLevelsProvider')]
  19. public function testIsHandling(Level $level)
  20. {
  21. $handler = new NoopHandler();
  22. $this->assertTrue($handler->isHandling($this->getRecord($level)));
  23. }
  24. #[DataProvider('logLevelsProvider')]
  25. public function testHandle(Level $level)
  26. {
  27. $handler = new NoopHandler();
  28. $this->assertFalse($handler->handle($this->getRecord($level)));
  29. }
  30. public static function logLevelsProvider()
  31. {
  32. return array_map(
  33. fn ($level) => [$level],
  34. Level::cases()
  35. );
  36. }
  37. }