mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 03:37:34 +02:00
CS fixes
This commit is contained in:
19
.php_cs
19
.php_cs
@@ -19,11 +19,14 @@ $finder = PhpCsFixer\Finder::create()
|
|||||||
|
|
||||||
return PhpCsFixer\Config::create()
|
return PhpCsFixer\Config::create()
|
||||||
->setUsingCache(true)
|
->setUsingCache(true)
|
||||||
//->setUsingLinter(false)
|
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->setRules(array(
|
->setRules(array(
|
||||||
'@PSR2' => true,
|
'@PSR2' => true,
|
||||||
'binary_operator_spaces' => true,
|
// some rules disabled as long as 1.x branch is maintained
|
||||||
|
'binary_operator_spaces' => array(
|
||||||
|
'align_double_arrow' => null,
|
||||||
|
'align_equals' => null,
|
||||||
|
),
|
||||||
'blank_line_before_return' => true,
|
'blank_line_before_return' => true,
|
||||||
'cast_spaces' => true,
|
'cast_spaces' => true,
|
||||||
'header_comment' => array('header' => $header),
|
'header_comment' => array('header' => $header),
|
||||||
@@ -31,29 +34,29 @@ return PhpCsFixer\Config::create()
|
|||||||
'method_separation' => true,
|
'method_separation' => true,
|
||||||
'no_blank_lines_after_class_opening' => true,
|
'no_blank_lines_after_class_opening' => true,
|
||||||
'no_blank_lines_after_phpdoc' => true,
|
'no_blank_lines_after_phpdoc' => true,
|
||||||
'no_blank_lines_between_uses' => true,
|
|
||||||
'no_empty_statement' => true,
|
'no_empty_statement' => true,
|
||||||
'no_extra_consecutive_blank_lines' => true,
|
'no_extra_consecutive_blank_lines' => true,
|
||||||
'no_leading_import_slash' => true,
|
'no_leading_import_slash' => true,
|
||||||
'no_leading_namespace_whitespace' => true,
|
'no_leading_namespace_whitespace' => true,
|
||||||
'no_trailing_comma_in_singleline_array' => true,
|
'no_trailing_comma_in_singleline_array' => true,
|
||||||
'no_unused_imports' => true,
|
'no_unused_imports' => true,
|
||||||
'no_whitespace_in_blank_lines' => true,
|
'no_whitespace_in_blank_line' => true,
|
||||||
'object_operator_without_whitespace' => true,
|
'object_operator_without_whitespace' => true,
|
||||||
'phpdoc_align' => true,
|
'phpdoc_align' => true,
|
||||||
'phpdoc_indent' => true,
|
'phpdoc_indent' => true,
|
||||||
'phpdoc_no_access' => true,
|
'phpdoc_no_access' => true,
|
||||||
'phpdoc_no_package' => true,
|
'phpdoc_no_package' => true,
|
||||||
'phpdoc_order' => true,
|
'phpdoc_order' => true,
|
||||||
'phpdoc_scalar' => true,
|
//'phpdoc_scalar' => true,
|
||||||
'phpdoc_trim' => true,
|
'phpdoc_trim' => true,
|
||||||
'phpdoc_type_to_var' => true,
|
//'phpdoc_types' => true,
|
||||||
'psr0' => true,
|
'psr0' => true,
|
||||||
'short_array_syntax' => true,
|
//'array_syntax' => array('syntax' => 'short'),
|
||||||
|
'declare_strict_types' => true,
|
||||||
'single_blank_line_before_namespace' => true,
|
'single_blank_line_before_namespace' => true,
|
||||||
'standardize_not_equals' => true,
|
'standardize_not_equals' => true,
|
||||||
'ternary_operator_spaces' => true,
|
'ternary_operator_spaces' => true,
|
||||||
'trailing_comma_in_multiline_array' => true,
|
'trailing_comma_in_multiline_array' => true,
|
||||||
))
|
))
|
||||||
->finder($finder)
|
->setFinder($finder)
|
||||||
;
|
;
|
||||||
|
@@ -76,7 +76,6 @@ class LineFormatter extends NormalizerFormatter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($vars['context'] as $var => $val) {
|
foreach ($vars['context'] as $var => $val) {
|
||||||
if (false !== strpos($output, '%context.'.$var.'%')) {
|
if (false !== strpos($output, '%context.'.$var.'%')) {
|
||||||
$output = str_replace('%context.'.$var.'%', $this->stringify($val), $output);
|
$output = str_replace('%context.'.$var.'%', $this->stringify($val), $output);
|
||||||
|
@@ -18,7 +18,6 @@ namespace Monolog\Formatter;
|
|||||||
*/
|
*/
|
||||||
class LogmaticFormatter extends JsonFormatter
|
class LogmaticFormatter extends JsonFormatter
|
||||||
{
|
{
|
||||||
|
|
||||||
const MARKERS = ["sourcecode", "php"];
|
const MARKERS = ["sourcecode", "php"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -57,7 +57,7 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @return int|bool|string|null|array
|
* @return int|bool|string|null|array
|
||||||
*/
|
*/
|
||||||
protected function normalize($data, int $depth = 0)
|
protected function normalize($data, int $depth = 0)
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
*
|
*
|
||||||
* (c) Roel Harbers <roelharbers@gmail.com>
|
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
@@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
namespace Monolog\Handler;
|
namespace Monolog\Handler;
|
||||||
|
|
||||||
use Monolog\Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No-op
|
* No-op
|
||||||
*
|
*
|
||||||
|
@@ -66,10 +66,10 @@ class PHPConsoleHandler extends AbstractProcessingHandler
|
|||||||
private $connector;
|
private $connector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details
|
* @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details
|
||||||
* @param Connector|null $connector Instance of \PhpConsole\Connector class (optional)
|
* @param Connector|null $connector Instance of \PhpConsole\Connector class (optional)
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @param bool $bubble
|
* @param bool $bubble
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function __construct(array $options = [], Connector $connector = null, $level = Logger::DEBUG, $bubble = true)
|
public function __construct(array $options = [], Connector $connector = null, $level = Logger::DEBUG, $bubble = true)
|
||||||
|
@@ -222,7 +222,7 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setRelease($value)
|
public function setRelease($value)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
@@ -127,7 +127,7 @@ class SlackRecord
|
|||||||
'color' => $this->getAttachmentColor($record['level']),
|
'color' => $this->getAttachmentColor($record['level']),
|
||||||
'fields' => array(),
|
'fields' => array(),
|
||||||
'mrkdwn_in' => array('fields'),
|
'mrkdwn_in' => array('fields'),
|
||||||
'ts' => $record['datetime']->getTimestamp()
|
'ts' => $record['datetime']->getTimestamp(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->useShortAttachment) {
|
if ($this->useShortAttachment) {
|
||||||
@@ -137,7 +137,6 @@ class SlackRecord
|
|||||||
$attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']);
|
$attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->includeContextAndExtra) {
|
if ($this->includeContextAndExtra) {
|
||||||
foreach (array('extra', 'context') as $key) {
|
foreach (array('extra', 'context') as $key) {
|
||||||
if (empty($record[$key])) {
|
if (empty($record[$key])) {
|
||||||
@@ -229,7 +228,7 @@ class SlackRecord
|
|||||||
/**
|
/**
|
||||||
* Generates attachment field
|
* Generates attachment field
|
||||||
*
|
*
|
||||||
* @param string $title
|
* @param string $title
|
||||||
* @param string|array $value\
|
* @param string|array $value\
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@@ -243,7 +242,7 @@ class SlackRecord
|
|||||||
return array(
|
return array(
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'short' => false
|
'short' => false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
@@ -36,16 +36,16 @@ class SlackWebhookHandler extends AbstractProcessingHandler
|
|||||||
private $slackRecord;
|
private $slackRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $webhookUrl Slack Webhook URL
|
* @param string $webhookUrl Slack Webhook URL
|
||||||
* @param string|null $channel Slack channel (encoded ID or name)
|
* @param string|null $channel Slack channel (encoded ID or name)
|
||||||
* @param string|null $username Name of a bot
|
* @param string|null $username Name of a bot
|
||||||
* @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
|
* @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
|
||||||
* @param string|null $iconEmoji The emoji name to use (or null)
|
* @param string|null $iconEmoji The emoji name to use (or null)
|
||||||
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
||||||
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
||||||
* @param int $level The minimum logging level at which this handler will be triggered
|
* @param int $level The minimum logging level at which this handler will be triggered
|
||||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||||
* @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
|
* @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
|
||||||
*/
|
*/
|
||||||
public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array())
|
public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array())
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
@@ -40,11 +40,11 @@ class SlackbotHandler extends AbstractProcessingHandler
|
|||||||
private $channel;
|
private $channel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $slackTeam Slack team slug
|
* @param string $slackTeam Slack team slug
|
||||||
* @param string $token Slackbot token
|
* @param string $token Slackbot token
|
||||||
* @param string $channel Slack channel (encoded ID or name)
|
* @param string $channel Slack channel (encoded ID or name)
|
||||||
* @param int $level The minimum logging level at which this handler will be triggered
|
* @param int $level The minimum logging level at which this handler will be triggered
|
||||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||||
*/
|
*/
|
||||||
public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true)
|
public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true)
|
||||||
{
|
{
|
||||||
|
@@ -125,7 +125,7 @@ class StreamHandler extends AbstractProcessingHandler
|
|||||||
/**
|
/**
|
||||||
* Write to stream
|
* Write to stream
|
||||||
* @param resource $stream
|
* @param resource $stream
|
||||||
* @param array $record
|
* @param array $record
|
||||||
*/
|
*/
|
||||||
protected function streamWrite($stream, array $record)
|
protected function streamWrite($stream, array $record)
|
||||||
{
|
{
|
||||||
|
@@ -397,9 +397,9 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param mixed $level The log level
|
* @param mixed $level The log level
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function log($level, $message, array $context = [])
|
public function log($level, $message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -413,8 +413,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function debug($message, array $context = [])
|
public function debug($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -426,8 +426,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function info($message, array $context = [])
|
public function info($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -439,8 +439,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function notice($message, array $context = [])
|
public function notice($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -452,8 +452,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function warning($message, array $context = [])
|
public function warning($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -465,8 +465,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function error($message, array $context = [])
|
public function error($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -478,8 +478,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function critical($message, array $context = [])
|
public function critical($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -491,8 +491,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function alert($message, array $context = [])
|
public function alert($message, array $context = [])
|
||||||
{
|
{
|
||||||
@@ -504,8 +504,8 @@ class Logger implements LoggerInterface
|
|||||||
*
|
*
|
||||||
* This method allows for compatibility with common interfaces.
|
* This method allows for compatibility with common interfaces.
|
||||||
*
|
*
|
||||||
* @param string $message The log message
|
* @param string $message The log message
|
||||||
* @param array $context The log context
|
* @param array $context The log context
|
||||||
*/
|
*/
|
||||||
public function emergency($message, array $context = [])
|
public function emergency($message, array $context = [])
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
|
@@ -15,7 +15,6 @@ use Monolog\Handler\TestHandler;
|
|||||||
|
|
||||||
class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testRegister()
|
public function testRegister()
|
||||||
{
|
{
|
||||||
$logger = new Logger('test', [$handler = new TestHandler]);
|
$logger = new Logger('test', [$handler = new TestHandler]);
|
||||||
@@ -46,7 +45,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[null, 10, str_repeat(' ', 1024 * 10), null],
|
[null, 10, str_repeat(' ', 1024 * 10), null],
|
||||||
[E_ALL, 15, str_repeat(' ', 1024 * 15), E_ALL]
|
[E_ALL, 15, str_repeat(' ', 1024 * 15), E_ALL],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
*
|
*
|
||||||
* (c) Roel Harbers <roelharbers@gmail.com>
|
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@@ -76,7 +76,7 @@ class RollbarHandlerTest extends TestCase
|
|||||||
private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null): array
|
private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null): array
|
||||||
{
|
{
|
||||||
return $this->getRecord($level, $message, [
|
return $this->getRecord($level, $message, [
|
||||||
'exception' => $exception ?: new Exception()
|
'exception' => $exception ?: new Exception(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
@@ -42,8 +42,8 @@ class SlackRecordTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider dataGetAttachmentColor
|
* @dataProvider dataGetAttachmentColor
|
||||||
* @param int $logLevel
|
* @param int $logLevel
|
||||||
* @param string $expectedColour RGB hex color or name of Slack color
|
* @param string $expectedColour RGB hex color or name of Slack color
|
||||||
* @covers ::getAttachmentColor
|
* @covers ::getAttachmentColor
|
||||||
*/
|
*/
|
||||||
public function testGetAttachmentColor($logLevel, $expectedColour)
|
public function testGetAttachmentColor($logLevel, $expectedColour)
|
||||||
@@ -88,7 +88,7 @@ class SlackRecordTest extends TestCase
|
|||||||
array(array(), '[]'),
|
array(array(), '[]'),
|
||||||
array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)),
|
array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)),
|
||||||
array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)),
|
array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)),
|
||||||
array($singleDimension, json_encode($singleDimension))
|
array($singleDimension, json_encode($singleDimension)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,13 +176,17 @@ class SlackRecordTest extends TestCase
|
|||||||
$formatter
|
$formatter
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('format')
|
->method('format')
|
||||||
->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; }));
|
->will($this->returnCallback(function ($record) {
|
||||||
|
return $record['message'] . 'test';
|
||||||
|
}));
|
||||||
|
|
||||||
$formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
$formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
||||||
$formatter2
|
$formatter2
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('format')
|
->method('format')
|
||||||
->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; }));
|
->will($this->returnCallback(function ($record) {
|
||||||
|
return $record['message'] . 'test1';
|
||||||
|
}));
|
||||||
|
|
||||||
$message = 'Test message';
|
$message = 'Test message';
|
||||||
$record = new SlackRecord(null, null, false, null, false, false, array(), $formatter);
|
$record = new SlackRecord(null, null, false, null, false, false, array(), $formatter);
|
||||||
@@ -268,13 +272,13 @@ class SlackRecordTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
'title' => 'Extra',
|
'title' => 'Extra',
|
||||||
'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)),
|
'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)),
|
||||||
'short' => false
|
'short' => false,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'Context',
|
'title' => 'Context',
|
||||||
'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)),
|
'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)),
|
||||||
'short' => false
|
'short' => false,
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
$attachment['fields']
|
$attachment['fields']
|
||||||
);
|
);
|
||||||
@@ -296,7 +300,7 @@ class SlackRecordTest extends TestCase
|
|||||||
array(array(
|
array(array(
|
||||||
'title' => 'Level',
|
'title' => 'Level',
|
||||||
'value' => $levelName,
|
'value' => $levelName,
|
||||||
'short' => false
|
'short' => false,
|
||||||
)),
|
)),
|
||||||
$attachment['fields']
|
$attachment['fields']
|
||||||
);
|
);
|
||||||
@@ -322,13 +326,13 @@ class SlackRecordTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
'title' => 'tags',
|
'title' => 'tags',
|
||||||
'value' => sprintf('```%s```', json_encode($extra['tags'])),
|
'value' => sprintf('```%s```', json_encode($extra['tags'])),
|
||||||
'short' => false
|
'short' => false,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'test',
|
'title' => 'test',
|
||||||
'value' => $context['test'],
|
'value' => $context['test'],
|
||||||
'short' => false
|
'short' => false,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$attachment = $data['attachments'][0];
|
$attachment = $data['attachments'][0];
|
||||||
@@ -370,12 +374,12 @@ class SlackRecordTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
'title' => 'info',
|
'title' => 'info',
|
||||||
'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)),
|
'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)),
|
||||||
'short' => false
|
'short' => false,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'title' => 'tags',
|
'title' => 'tags',
|
||||||
'value' => sprintf('```%s```', json_encode(array('web'))),
|
'value' => sprintf('```%s```', json_encode(array('web'))),
|
||||||
'short' => false
|
'short' => false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
|
Reference in New Issue
Block a user