ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
12 namespace Monolog\Handler;
13 
15 use Monolog\Logger;
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 }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
testHandlerUsesLineFormatterWhichIgnoresEmptyArrays()
::getDefaultFormatter
Sends logs to Fleep.io using Webhook integrations.
Create styles array
The data for the language used.
static getLevelName($level)
Gets the name of the logging level.
Definition: Logger.php:458
Formats incoming records into a one-line string.
const TOKEN
Default token to use in tests.