Пример #1
0
 public function testAddsLongAttachmentWithContextAndExtra()
 {
     $level = Logger::ERROR;
     $levelName = Logger::getLevelName($level);
     $record = new SlackRecord($this->channel, 'Monolog', true, null, false, true);
     $loggerRecord = $this->getRecord($level, 'test', array('test' => 1));
     $loggerRecord['extra'] = array('tags' => array('web'));
     $data = $record->getSlackData($loggerRecord);
     $expectedFields = array(array('title' => 'Level', 'value' => $levelName, 'short' => true), array('title' => 'tags', 'value' => '["web"]', 'short' => false), array('title' => 'test', 'value' => 1, 'short' => false));
     $attachment = $data['attachments'][0];
     $this->assertArrayHasKey('title', $attachment);
     $this->assertArrayHasKey('fields', $attachment);
     $this->assertCount(3, $attachment['fields']);
     $this->assertSame('Message', $attachment['title']);
     $this->assertSame($expectedFields, $attachment['fields']);
 }
Пример #2
0
 public function getFormatter()
 {
     $formatter = parent::getFormatter();
     $this->slackRecord->setFormatter($formatter);
     return $formatter;
 }