mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-11 23:54:04 +02:00
Merge pull request #1359 from MarioBlazek/feature_upgrade_phpunit_to_v8
Upgrade PHPUnit to v8
This commit is contained in:
@@ -15,7 +15,7 @@ use Monolog\Logger;
|
||||
|
||||
class ElasticaFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!class_exists("Elastica\Document")) {
|
||||
$this->markTestSkipped("ruflin/elastica not installed");
|
||||
|
@@ -12,10 +12,11 @@
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class GelfMessageFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
class GelfMessageFormatterTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!class_exists('\Gelf\Message')) {
|
||||
$this->markTestSkipped("graylog2/gelf-php is not installed");
|
||||
@@ -82,7 +83,6 @@ class GelfMessageFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @covers Monolog\Formatter\GelfMessageFormatter::format
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testFormatInvalidFails()
|
||||
{
|
||||
@@ -92,6 +92,8 @@ class GelfMessageFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
'level_name' => 'ERROR',
|
||||
];
|
||||
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
$formatter->format($record);
|
||||
}
|
||||
|
||||
|
@@ -12,16 +12,10 @@
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
use Monolog\Logger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LogstashFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
class LogstashFormatterTest extends TestCase
|
||||
{
|
||||
public function tearDown()
|
||||
{
|
||||
\PHPUnit\Framework\Error\Warning::$enabled = true;
|
||||
|
||||
return parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Monolog\Formatter\LogstashFormatter::format
|
||||
*/
|
||||
|
@@ -18,7 +18,7 @@ use Monolog\Logger;
|
||||
*/
|
||||
class MongoDBFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!class_exists('MongoDB\BSON\UTCDateTime')) {
|
||||
$this->markTestSkipped('ext-mongodb not installed');
|
||||
|
@@ -11,18 +11,13 @@
|
||||
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers Monolog\Formatter\NormalizerFormatter
|
||||
*/
|
||||
class NormalizerFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
class NormalizerFormatterTest extends TestCase
|
||||
{
|
||||
public function tearDown()
|
||||
{
|
||||
\PHPUnit\Framework\Error\Warning::$enabled = true;
|
||||
|
||||
return parent::tearDown();
|
||||
}
|
||||
|
||||
public function testFormat()
|
||||
{
|
||||
$formatter = new NormalizerFormatter('Y-m-d');
|
||||
@@ -267,9 +262,6 @@ class NormalizerFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException RuntimeException
|
||||
*/
|
||||
public function testThrowsOnInvalidEncoding()
|
||||
{
|
||||
$formatter = new NormalizerFormatter();
|
||||
@@ -279,6 +271,9 @@ class NormalizerFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
// send an invalid unicode sequence as a object that can't be cleaned
|
||||
$record = new \stdClass;
|
||||
$record->message = "\xB1\x31";
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
|
||||
$reflMethod->invoke($formatter, $record);
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ class ScalarFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private $formatter;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->formatter = new ScalarFormatter();
|
||||
}
|
||||
|
@@ -91,10 +91,11 @@ class WildfireFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
/**
|
||||
* @covers Monolog\Formatter\WildfireFormatter::formatBatch
|
||||
* @expectedException BadMethodCallException
|
||||
*/
|
||||
public function testBatchFormatThrowException()
|
||||
{
|
||||
$this->expectException(\BadMethodCallException::class);
|
||||
|
||||
$wildfire = new WildfireFormatter();
|
||||
$record = [
|
||||
'level' => Logger::ERROR,
|
||||
|
Reference in New Issue
Block a user