LoadAverageProcessorTest.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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\Processor;
  11. class LoadAverageProcessorTest extends \Monolog\Test\MonologTestCase
  12. {
  13. /**
  14. * @covers Monolog\Processor\LoadAverageProcessor::__invoke
  15. */
  16. public function testProcessor()
  17. {
  18. $processor = new LoadAverageProcessor();
  19. $record = $processor($this->getRecord());
  20. $this->assertArrayHasKey('load_average', $record->extra);
  21. $this->assertIsFloat($record->extra['load_average']);
  22. }
  23. /**
  24. * @covers Monolog\Processor\LoadAverageProcessor::__invoke
  25. */
  26. public function testProcessorWithInvalidAvgSystemLoad()
  27. {
  28. $this->expectException(\InvalidArgumentException::class);
  29. $this->expectExceptionMessage('Invalid average system load: `3`');
  30. new LoadAverageProcessor(3);
  31. }
  32. }