1
0
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:
Jordi Boggiano
2019-08-15 21:32:19 +02:00
committed by GitHub
48 changed files with 175 additions and 170 deletions

View File

@@ -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");

View File

@@ -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);
}

View File

@@ -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
*/

View File

@@ -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');

View File

@@ -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);
}

View File

@@ -17,7 +17,7 @@ class ScalarFormatterTest extends \PHPUnit\Framework\TestCase
{
private $formatter;
public function setUp()
public function setUp(): void
{
$this->formatter = new ScalarFormatter();
}

View File

@@ -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,