NoopHandlerTest.php 1.0 KB

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