diff options
author | Jordi Boggiano <j.boggiano@seld.be> | 2011-07-20 00:05:18 +0200 |
---|---|---|
committer | Jordi Boggiano <j.boggiano@seld.be> | 2011-07-20 00:05:18 +0200 |
commit | 45b6740a0ef76038b5fc5151943f14b899b6971b (patch) | |
tree | f39baabd7c8fd9af5ba74c64f221ee46a3d9ff13 | |
parent | 2bf653b39c4b79993eee17994a6bf6eecea1ee50 (diff) | |
download | monolog-45b6740a0ef76038b5fc5151943f14b899b6971b.zip monolog-45b6740a0ef76038b5fc5151943f14b899b6971b.tar.gz monolog-45b6740a0ef76038b5fc5151943f14b899b6971b.tar.bz2 |
Add tests for Memory processors
-rw-r--r-- | tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php | 29 | ||||
-rw-r--r-- | tests/Monolog/Processor/MemoryUsageProcessorTest.php | 29 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php new file mode 100644 index 0000000..4bdf22c --- /dev/null +++ b/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php @@ -0,0 +1,29 @@ +<?php + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class MemoryPeakUsageProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke + * @covers Monolog\Processor\MemoryProcessor::formatBytes + */ + public function testProcessor() + { + $processor = new MemoryPeakUsageProcessor(); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('memory_peak_usage', $record['extra']); + $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']); + } +} diff --git a/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/tests/Monolog/Processor/MemoryUsageProcessorTest.php new file mode 100644 index 0000000..a30d6de --- /dev/null +++ b/tests/Monolog/Processor/MemoryUsageProcessorTest.php @@ -0,0 +1,29 @@ +<?php + +/* + * This file is part of the Monolog package. + * + * (c) Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Processor; + +use Monolog\TestCase; + +class MemoryUsageProcessorTest extends TestCase +{ + /** + * @covers Monolog\Processor\MemoryUsageProcessor::__invoke + * @covers Monolog\Processor\MemoryProcessor::formatBytes + */ + public function testProcessor() + { + $processor = new MemoryUsageProcessor(); + $record = $processor($this->getRecord()); + $this->assertArrayHasKey('memory_usage', $record['extra']); + $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']); + } +} |