scratch – Blame information for rev
?pathlinks?
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; |
||
13 | |||
14 | class TestCase extends \PHPUnit_Framework_TestCase |
||
15 | { |
||
16 | /** |
||
17 | * @return array Record |
||
18 | */ |
||
19 | protected function getRecord($level = Logger::WARNING, $message = 'test', $context = array()) |
||
20 | { |
||
21 | return array( |
||
22 | 'message' => $message, |
||
23 | 'context' => $context, |
||
24 | 'level' => $level, |
||
25 | 'level_name' => Logger::getLevelName($level), |
||
26 | 'channel' => 'test', |
||
27 | 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))), |
||
28 | 'extra' => array(), |
||
29 | ); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return array |
||
34 | */ |
||
35 | protected function getMultipleRecords() |
||
36 | { |
||
37 | return array( |
||
38 | $this->getRecord(Logger::DEBUG, 'debug message 1'), |
||
39 | $this->getRecord(Logger::DEBUG, 'debug message 2'), |
||
40 | $this->getRecord(Logger::INFO, 'information'), |
||
41 | $this->getRecord(Logger::WARNING, 'warning'), |
||
42 | $this->getRecord(Logger::ERROR, 'error'), |
||
43 | ); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return Monolog\Formatter\FormatterInterface |
||
48 | */ |
||
49 | protected function getIdentityFormatter() |
||
50 | { |
||
51 | $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); |
||
52 | $formatter->expects($this->any()) |
||
53 | ->method('format') |
||
54 | ->will($this->returnCallback(function ($record) { return $record['message']; })); |
||
55 | |||
56 | return $formatter; |
||
57 | } |
||
58 | } |