4 * This file is part of the Monolog package.
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Monolog\Processor;
16 class MemoryPeakUsageProcessorTest extends TestCase
19 * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
20 * @covers Monolog\Processor\MemoryProcessor::formatBytes
22 public function testProcessor()
24 $processor = new MemoryPeakUsageProcessor();
25 $record = $processor($this->getRecord());
26 $this->assertArrayHasKey('memory_peak_usage', $record['extra']);
27 $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']);
31 * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
32 * @covers Monolog\Processor\MemoryProcessor::formatBytes
34 public function testProcessorWithoutFormatting()
36 $processor = new MemoryPeakUsageProcessor(true, false);
37 $record = $processor($this->getRecord());
38 $this->assertArrayHasKey('memory_peak_usage', $record['extra']);
39 $this->assertInternalType('int', $record['extra']['memory_peak_usage']);
40 $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']);