1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-13 16:44:23 +02:00

Upgrade PHPUnit to v8

This commit is contained in:
Mario Blažek
2019-08-12 15:20:00 +02:00
parent 2e3c369667
commit 37900f9268
46 changed files with 154 additions and 166 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,10 +83,11 @@ class GelfMessageFormatterTest extends \PHPUnit\Framework\TestCase
/**
* @covers Monolog\Formatter\GelfMessageFormatter::format
* @expectedException InvalidArgumentException
*/
public function testFormatInvalidFails()
{
$this->expectException(\InvalidArgumentException::class);
$formatter = new GelfMessageFormatter();
$record = [
'level' => Logger::ERROR,

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');
@@ -263,11 +258,10 @@ class NormalizerFormatterTest extends \PHPUnit\Framework\TestCase
$this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
}
/**
* @expectedException RuntimeException
*/
public function testThrowsOnInvalidEncoding()
{
$this->expectException(\RuntimeException::class);
$formatter = new NormalizerFormatter();
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
$reflMethod->setAccessible(true);

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,