ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
FluentdFormatterTest.php
Go to the documentation of this file.
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
12namespace Monolog\Formatter;
13
16
18{
23 public function testConstruct()
24 {
25 $formatter = new FluentdFormatter();
26 $this->assertEquals(false, $formatter->isUsingLevelsInTag());
27 $formatter = new FluentdFormatter(false);
28 $this->assertEquals(false, $formatter->isUsingLevelsInTag());
29 $formatter = new FluentdFormatter(true);
30 $this->assertEquals(true, $formatter->isUsingLevelsInTag());
31 }
32
36 public function testFormat()
37 {
38 $record = $this->getRecord(Logger::WARNING);
39 $record['datetime'] = new \DateTime("@0");
40
41 $formatter = new FluentdFormatter();
42 $this->assertEquals(
43 '["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]',
44 $formatter->format($record)
45 );
46 }
47
51 public function testFormatWithTag()
52 {
53 $record = $this->getRecord(Logger::ERROR);
54 $record['datetime'] = new \DateTime("@0");
55
56 $formatter = new FluentdFormatter(true);
57 $this->assertEquals(
58 '["test.error",0,{"message":"test","extra":[]}]',
59 $formatter->format($record)
60 );
61 }
62}
An exception for terminatinating execution or to throw for unit testing.
testFormatWithTag()
@covers Monolog\Formatter\FluentdFormatter::format
testConstruct()
@covers Monolog\Formatter\FluentdFormatter::__construct @covers Monolog\Formatter\FluentdFormatter::i...
testFormat()
@covers Monolog\Formatter\FluentdFormatter::format
Monolog log channel.
Definition: Logger.php:28
const ERROR
Runtime errors.
Definition: Logger.php:57
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19