mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-29 11:26:09 +01:00
Fix phpunit deprecations
This commit is contained in:
@@ -15,6 +15,7 @@ use Monolog\Handler\HandlerInterface;
|
||||
use Monolog\Processor\WebProcessor;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Test\TestCase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
|
||||
class LoggerTest extends TestCase
|
||||
{
|
||||
@@ -161,7 +162,7 @@ class LoggerTest extends TestCase
|
||||
$logger = new Logger(__METHOD__);
|
||||
|
||||
$handler = $this->getMockBuilder('Monolog\Handler\HandlerInterface')->getMock();
|
||||
$handler->expects($this->once())->method('isHandling')->will($this->returnValue(false));
|
||||
$handler->expects($this->once())->method('isHandling')->willReturn(false);
|
||||
$handler->expects($this->never())->method('handle');
|
||||
|
||||
$logger->pushProcessor(fn (LogRecord $record) => $record);
|
||||
@@ -283,11 +284,11 @@ class LoggerTest extends TestCase
|
||||
$handler = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler->expects($this->any())
|
||||
->method('handle')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$logger->pushHandler($handler);
|
||||
|
||||
@@ -298,7 +299,7 @@ class LoggerTest extends TestCase
|
||||
;
|
||||
$processor->expects($this->once())
|
||||
->method('__invoke')
|
||||
->will($this->returnArgument(0))
|
||||
->willReturnArgument(0)
|
||||
;
|
||||
$logger->pushProcessor($processor);
|
||||
|
||||
@@ -314,7 +315,7 @@ class LoggerTest extends TestCase
|
||||
$handler = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler->expects($this->once())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$logger->pushHandler($handler);
|
||||
$that = $this;
|
||||
@@ -335,29 +336,29 @@ class LoggerTest extends TestCase
|
||||
$handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler1->expects($this->never())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$handler1->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$logger->pushHandler($handler1);
|
||||
|
||||
$handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler2->expects($this->once())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler2->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$logger->pushHandler($handler2);
|
||||
|
||||
$handler3 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler3->expects($this->once())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$handler3->expects($this->never())
|
||||
->method('handle')
|
||||
@@ -375,27 +376,27 @@ class LoggerTest extends TestCase
|
||||
$handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler1->expects($this->never())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$handler1->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
|
||||
$handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler2->expects($this->once())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler2->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
|
||||
$handler3 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler3->expects($this->once())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$handler3->expects($this->never())
|
||||
->method('handle')
|
||||
@@ -417,22 +418,22 @@ class LoggerTest extends TestCase
|
||||
$handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler1->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler1->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$logger->pushHandler($handler1);
|
||||
|
||||
$handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler2->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler2->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
$logger->pushHandler($handler2);
|
||||
|
||||
@@ -449,7 +450,7 @@ class LoggerTest extends TestCase
|
||||
$handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler1->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler1->expects($this->never())
|
||||
->method('handle')
|
||||
@@ -459,11 +460,11 @@ class LoggerTest extends TestCase
|
||||
$handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler2->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler2->expects($this->once())
|
||||
->method('handle')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$logger->pushHandler($handler2);
|
||||
|
||||
@@ -480,7 +481,7 @@ class LoggerTest extends TestCase
|
||||
$handler1 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler1->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(false))
|
||||
->willReturn(false);
|
||||
;
|
||||
|
||||
$logger->pushHandler($handler1);
|
||||
@@ -489,7 +490,7 @@ class LoggerTest extends TestCase
|
||||
$handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
|
||||
$handler2->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
|
||||
$logger->pushHandler($handler2);
|
||||
@@ -497,7 +498,6 @@ class LoggerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider logMethodProvider
|
||||
* @covers Level::Debug
|
||||
* @covers Level::Info
|
||||
* @covers Level::Notice
|
||||
@@ -507,6 +507,7 @@ class LoggerTest extends TestCase
|
||||
* @covers Level::Alert
|
||||
* @covers Level::Emergency
|
||||
*/
|
||||
#[DataProvider('logMethodProvider')]
|
||||
public function testLogMethods(string $method, Level $expectedLevel)
|
||||
{
|
||||
$logger = new Logger('foo');
|
||||
@@ -533,9 +534,9 @@ class LoggerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider setTimezoneProvider
|
||||
* @covers Logger::setTimezone
|
||||
*/
|
||||
#[DataProvider('setTimezoneProvider')]
|
||||
public function testSetTimezone($tz)
|
||||
{
|
||||
$logger = new Logger('foo');
|
||||
@@ -608,10 +609,10 @@ class LoggerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider useMicrosecondTimestampsProvider
|
||||
* @covers Logger::useMicrosecondTimestamps
|
||||
* @covers Logger::addRecord
|
||||
*/
|
||||
#[DataProvider('useMicrosecondTimestampsProvider')]
|
||||
public function testUseMicrosecondTimestamps($micro, $assert, $assertFormat)
|
||||
{
|
||||
if (PHP_VERSION_ID === 70103) {
|
||||
@@ -675,7 +676,7 @@ class LoggerTest extends TestCase
|
||||
$handler = $this->getMockBuilder('Monolog\Handler\HandlerInterface')->getMock();
|
||||
$handler->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler->expects($this->any())
|
||||
->method('handle')
|
||||
@@ -704,7 +705,7 @@ class LoggerTest extends TestCase
|
||||
$handler = $this->getMockBuilder('Monolog\Handler\HandlerInterface')->getMock();
|
||||
$handler->expects($this->any())
|
||||
->method('isHandling')
|
||||
->will($this->returnValue(true))
|
||||
->willReturn(true);
|
||||
;
|
||||
$handler->expects($this->any())
|
||||
->method('handle')
|
||||
|
||||
Reference in New Issue
Block a user