1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 23:54:04 +02:00
This commit is contained in:
Jordi Boggiano
2018-06-18 18:53:38 +02:00
parent fa9c4ebf3e
commit 41b8f5ebf4
29 changed files with 71 additions and 56 deletions

View File

@@ -183,6 +183,7 @@ class ElasticSearchHandlerTest extends TestCase
$client = new Client();
$handler = new ElasticSearchHandler($client, $this->options);
try {
$handler->handleBatch([$msg]);
} catch (\RuntimeException $e) {

View File

@@ -146,7 +146,10 @@ class FilterHandlerTest extends TestCase
$handler = new FilterHandler(
function ($record, $handler) use ($test) {
return $test;
}, Logger::INFO, Logger::NOTICE, false
},
Logger::INFO,
Logger::NOTICE,
false
);
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::INFO));

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the Monolog package.
@@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/
namespace Monolog\Handler;
use Monolog\Test\TestCase;
namespace Monolog\Handler;
use Monolog\Test\TestCase;
use Monolog\Logger;
/**
/**
* @author Robert Kaufmann III <rok3@rok3.me>
* @author Gabriel Machado <gabriel.ms1@hotmail.com>
*/
@@ -62,7 +62,6 @@ class InsightOpsHandlerTest extends TestCase
->setConstructorArgs($args)
->getMock();
$reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($this->handler, 'localhost:1234');

View File

@@ -59,9 +59,9 @@ class RollbarHandlerTest extends TestCase
{
$config = array(
'access_token' => 'ad865e76e7fb496fab096ac07b1dbabb',
'environment' => 'test'
'environment' => 'test',
);
$this->rollbarLogger = $this->getMockBuilder(RollbarLogger::class)
->setConstructorArgs(array($config))
->setMethods(array('log'))

View File

@@ -102,10 +102,10 @@ class RotatingFileHandlerTest extends TestCase
$dayCallback = function ($ago) use ($now) {
return $now + 86400 * $ago;
};
$monthCallback = function($ago) {
$monthCallback = function ($ago) {
return gmmktime(0, 0, 0, (int) (date('n') + $ago), 1, (int) date('Y'));
};
$yearCallback = function($ago) {
$yearCallback = function ($ago) {
return gmmktime(0, 0, 0, 1, 1, (int) (date('Y') + $ago));
};
@@ -216,7 +216,6 @@ class RotatingFileHandlerTest extends TestCase
public function rotationWhenSimilarFilesExistTests()
{
return array(
'Rotation is triggered when the file of the current day is not present but similar exists'
=> array(RotatingFileHandler::FILE_PER_DAY),

View File

@@ -54,7 +54,8 @@ class TestHandlerTest extends TestCase
$this->assertEquals([$record], $records);
}
public function testHandlerAssertEmptyContext() {
public function testHandlerAssertEmptyContext()
{
$handler = new TestHandler;
$record = $this->getRecord(Logger::WARNING, 'test', []);
$this->assertFalse($handler->hasWarning([
@@ -71,18 +72,19 @@ class TestHandlerTest extends TestCase
$this->assertFalse($handler->hasWarning([
'message' => 'test',
'context' => [
'foo' => 'bar'
'foo' => 'bar',
],
]));
}
public function testHandlerAssertNonEmptyContext() {
public function testHandlerAssertNonEmptyContext()
{
$handler = new TestHandler;
$record = $this->getRecord(Logger::WARNING, 'test', ['foo' => 'bar']);
$this->assertFalse($handler->hasWarning([
'message' => 'test',
'context' => [
'foo' => 'bar'
'foo' => 'bar',
],
]));
@@ -91,7 +93,7 @@ class TestHandlerTest extends TestCase
$this->assertTrue($handler->hasWarning([
'message' => 'test',
'context' => [
'foo' => 'bar'
'foo' => 'bar',
],
]));
$this->assertFalse($handler->hasWarning([