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 ()
 @covers ::__construct @covers ::getSlackRecord More...
 
 testConstructorFull ()
 @covers ::__construct @covers ::getSlackRecord More...
 
 testGetFormatter ()
 @covers ::getFormatter More...
 
 testSetFormatter ()
 @covers ::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

Author
Haralan Dobrev hkdob.nosp@m.rev@.nosp@m.gmail.nosp@m..com
See also
https://api.slack.com/incoming-webhooks @coversDefaultClass Monolog\Handler\SlackWebhookHandler

Definition at line 24 of file SlackWebhookHandlerTest.php.

Member Function Documentation

◆ testConstructorFull()

Monolog\Handler\SlackWebhookHandlerTest::testConstructorFull ( )

@covers ::__construct @covers ::getSlackRecord

Definition at line 63 of file SlackWebhookHandlerTest.php.

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

References $handler, and Monolog\Logger\DEBUG.

◆ testConstructorMinimal()

Monolog\Handler\SlackWebhookHandlerTest::testConstructorMinimal ( )

@covers ::__construct @covers ::getSlackRecord

Definition at line 32 of file SlackWebhookHandlerTest.php.

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',
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

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

+ Here is the call graph for this function:

◆ testGetFormatter()

Monolog\Handler\SlackWebhookHandlerTest::testGetFormatter ( )

@covers ::getFormatter

Definition at line 90 of file SlackWebhookHandlerTest.php.

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

References $handler.

◆ testSetFormatter()

Monolog\Handler\SlackWebhookHandlerTest::testSetFormatter ( )

@covers ::setFormatter

Definition at line 100 of file SlackWebhookHandlerTest.php.

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

References $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: