scratch – Blame information for rev 115

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <?php
2  
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11  
12 namespace Monolog\Processor;
13  
14 use Monolog\TestCase;
15  
16 class MemoryUsageProcessorTest extends TestCase
17 {
18 /**
19 * @covers Monolog\Processor\MemoryUsageProcessor::__invoke
20 * @covers Monolog\Processor\MemoryProcessor::formatBytes
21 */
22 public function testProcessor()
23 {
24 $processor = new MemoryUsageProcessor();
25 $record = $processor($this->getRecord());
26 $this->assertArrayHasKey('memory_usage', $record['extra']);
27 $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']);
28 }
29  
30 /**
31 * @covers Monolog\Processor\MemoryUsageProcessor::__invoke
32 * @covers Monolog\Processor\MemoryProcessor::formatBytes
33 */
34 public function testProcessorWithoutFormatting()
35 {
36 $processor = new MemoryUsageProcessor(true, false);
37 $record = $processor($this->getRecord());
38 $this->assertArrayHasKey('memory_usage', $record['extra']);
39 $this->assertInternalType('int', $record['extra']['memory_usage']);
40 $this->assertGreaterThan(0, $record['extra']['memory_usage']);
41 }
42 }