ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Handler\SlackWebhookHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\SlackWebhookHandlerTest:
+ Collaboration diagram for Monolog\Handler\SlackWebhookHandlerTest:

Public Member Functions

 testConstructorMinimal ()
 ::__construct ::getSlackRecord More...
 
 testConstructorFull ()
 ::__construct ::getSlackRecord More...
 
 testGetFormatter ()
 ::getFormatter More...
 
 testSetFormatter ()
 ::setFormatter More...
 

Data Fields

const WEBHOOK_URL = 'https://hooks.slack.com/services/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E'
 

Additional Inherited Members

- Protected Member Functions inherited from Monolog\TestCase
 getRecord ($level=Logger::WARNING, $message='test', $context=array())
 
 getMultipleRecords ()
 
 getIdentityFormatter ()
 

Detailed Description

Member Function Documentation

◆ testConstructorFull()

Monolog\Handler\SlackWebhookHandlerTest::testConstructorFull ( )

::__construct ::getSlackRecord

Definition at line 63 of file SlackWebhookHandlerTest.php.

References $handler, and Monolog\Logger\DEBUG.

64  {
65  $handler = new SlackWebhookHandler(
66  self::WEBHOOK_URL,
67  'test-channel',
68  'test-username',
69  false,
70  ':ghost:',
71  false,
72  false,
74  false
75  );
76 
77  $slackRecord = $handler->getSlackRecord();
78  $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
79  $this->assertEquals(array(
80  'username' => 'test-username',
81  'text' => 'test',
82  'channel' => 'test-channel',
83  'icon_emoji' => ':ghost:',
84  ), $slackRecord->getSlackData($this->getRecord()));
85  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
$handler

◆ testConstructorMinimal()

Monolog\Handler\SlackWebhookHandlerTest::testConstructorMinimal ( )

::__construct ::getSlackRecord

Definition at line 32 of file SlackWebhookHandlerTest.php.

References $handler, Monolog\Handler\Slack\SlackRecord\COLOR_WARNING, and Monolog\TestCase\getRecord().

33  {
34  $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
35  $record = $this->getRecord();
36  $slackRecord = $handler->getSlackRecord();
37  $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
38  $this->assertEquals(array(
39  'attachments' => array(
40  array(
41  'fallback' => 'test',
42  'text' => 'test',
43  'color' => SlackRecord::COLOR_WARNING,
44  'fields' => array(
45  array(
46  'title' => 'Level',
47  'value' => 'WARNING',
48  'short' => false,
49  ),
50  ),
51  'title' => 'Message',
52  'mrkdwn_in' => array('fields'),
53  'ts' => $record['datetime']->getTimestamp(),
54  ),
55  ),
56  ), $slackRecord->getSlackData($record));
57  }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testGetFormatter()

Monolog\Handler\SlackWebhookHandlerTest::testGetFormatter ( )

::getFormatter

Definition at line 90 of file SlackWebhookHandlerTest.php.

References $handler.

91  {
92  $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
93  $formatter = $handler->getFormatter();
94  $this->assertInstanceOf('Monolog\Formatter\FormatterInterface', $formatter);
95  }
$handler

◆ testSetFormatter()

Monolog\Handler\SlackWebhookHandlerTest::testSetFormatter ( )

::setFormatter

Definition at line 100 of file SlackWebhookHandlerTest.php.

References $handler.

101  {
102  $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
103  $formatter = new LineFormatter();
104  $handler->setFormatter($formatter);
105  $this->assertSame($formatter, $handler->getFormatter());
106  }
$handler

Field Documentation

◆ WEBHOOK_URL

const Monolog\Handler\SlackWebhookHandlerTest::WEBHOOK_URL = 'https://hooks.slack.com/services/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E'

Definition at line 26 of file SlackWebhookHandlerTest.php.


The documentation for this class was generated from the following file: