LoadAverageProcessorTest.php 1.0 KB

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