mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-08 14:16:42 +02:00
Merge branch 'master' into update_phpunit_7
This commit is contained in:
@@ -136,7 +136,7 @@ class TestChromePHPHandler extends ChromePHPHandler
|
||||
{
|
||||
protected $headers = [];
|
||||
|
||||
public static function resetStatic()
|
||||
public static function resetStatic(): void
|
||||
{
|
||||
self::$initialized = false;
|
||||
self::$overflowed = false;
|
||||
@@ -144,12 +144,12 @@ class TestChromePHPHandler extends ChromePHPHandler
|
||||
self::$json['rows'] = [];
|
||||
}
|
||||
|
||||
protected function sendHeader($header, $content)
|
||||
protected function sendHeader(string $header, string $content): void
|
||||
{
|
||||
$this->headers[$header] = $content;
|
||||
}
|
||||
|
||||
public function getHeaders()
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
@@ -77,19 +77,19 @@ class TestFirePHPHandler extends FirePHPHandler
|
||||
{
|
||||
protected $headers = [];
|
||||
|
||||
public static function resetStatic()
|
||||
public static function resetStatic(): void
|
||||
{
|
||||
self::$initialized = false;
|
||||
self::$sendHeaders = true;
|
||||
self::$messageIndex = 1;
|
||||
}
|
||||
|
||||
protected function sendHeader($header, $content)
|
||||
protected function sendHeader(string $header, string $content): void
|
||||
{
|
||||
$this->headers[$header] = $content;
|
||||
}
|
||||
|
||||
public function getHeaders()
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
@@ -163,7 +163,7 @@ class NewRelicHandlerTest extends TestCase
|
||||
|
||||
class StubNewRelicHandlerWithoutExtension extends NewRelicHandler
|
||||
{
|
||||
protected function isNewRelicEnabled()
|
||||
protected function isNewRelicEnabled(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ class StubNewRelicHandlerWithoutExtension extends NewRelicHandler
|
||||
|
||||
class StubNewRelicHandler extends NewRelicHandler
|
||||
{
|
||||
protected function isNewRelicEnabled()
|
||||
protected function isNewRelicEnabled(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Test\TestCase;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
|
||||
/**
|
||||
* @covers Monolog\Handler\PsrHandler::handle
|
||||
@@ -47,4 +48,21 @@ class PsrHandlerTest extends TestCase
|
||||
$handler = new PsrHandler($psrLogger);
|
||||
$handler->handle(['level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context]);
|
||||
}
|
||||
|
||||
public function testFormatter()
|
||||
{
|
||||
$message = 'Hello, world!';
|
||||
$context = ['foo' => 'bar'];
|
||||
$level = Logger::ERROR;
|
||||
$levelName = 'error';
|
||||
|
||||
$psrLogger = $this->createMock('Psr\Log\NullLogger');
|
||||
$psrLogger->expects($this->once())
|
||||
->method('log')
|
||||
->with(strtolower($levelName), 'dummy', $context);
|
||||
|
||||
$handler = new PsrHandler($psrLogger);
|
||||
$handler->setFormatter(new LineFormatter('dummy'));
|
||||
$handler->handle(['level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context, 'extra' => [], 'date' => new \DateTimeImmutable()]);
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class SyslogUdpHandlerTest extends TestCase
|
||||
*/
|
||||
public function testWeValidateFacilities()
|
||||
{
|
||||
$handler = new SyslogUdpHandler("ip", null, "invalidFacility");
|
||||
$handler = new SyslogUdpHandler("ip", 514, "invalidFacility");
|
||||
}
|
||||
|
||||
public function testWeSplitIntoLines()
|
||||
|
Reference in New Issue
Block a user