ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
FleepHookHandlerTest.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\Handler;
13
17
22{
26 const TOKEN = '123abc';
27
31 private $handler;
32
33 public function setUp()
34 {
35 parent::setUp();
36
37 if (!extension_loaded('openssl')) {
38 $this->markTestSkipped('This test requires openssl extension to run');
39 }
40
41 // Create instances of the handler and logger for convenience
42 $this->handler = new FleepHookHandler(self::TOKEN);
43 }
44
49 {
50 $this->assertEquals(Logger::DEBUG, $this->handler->getLevel());
51 $this->assertEquals(true, $this->handler->getBubble());
52 }
53
58 {
59 $record = array(
60 'message' => 'msg',
61 'context' => array(),
62 'level' => Logger::DEBUG,
63 'level_name' => Logger::getLevelName(Logger::DEBUG),
64 'channel' => 'channel',
65 'datetime' => new \DateTime(),
66 'extra' => array(),
67 );
68
69 $expectedFormatter = new LineFormatter(null, null, true, true);
70 $expected = $expectedFormatter->format($record);
71
72 $handlerFormatter = $this->handler->getFormatter();
73 $actual = $handlerFormatter->format($record);
74
75 $this->assertEquals($expected, $actual, 'Empty context and extra arrays should not be rendered');
76 }
77
82 {
83 $this->assertEquals('ssl://' . FleepHookHandler::FLEEP_HOST . ':443', $this->handler->getConnectionString());
84 }
85}
Formats incoming records into a one-line string.
@coversDefaultClass \Monolog\Handler\FleepHookHandler
testConstructorSetsExpectedDefaults()
@covers ::__construct
testHandlerUsesLineFormatterWhichIgnoresEmptyArrays()
@covers ::getDefaultFormatter
const TOKEN
Default token to use in tests.
testConnectionStringisConstructedCorrectly()
@covers ::__construct
Sends logs to Fleep.io using Webhook integrations.
Monolog log channel.
Definition: Logger.php:28
static getLevelName($level)
Gets the name of the logging level.
Definition: Logger.php:388
const DEBUG
Detailed debug information.
Definition: Logger.php:32