From 85611302150416c48f998281160a90cb58f74887 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 20 Jun 2023 15:56:11 +0200 Subject: [PATCH] Upgrade to phpunit 10 (#1806) Co-authored-by: Christopher Georg --- .github/workflows/continuous-integration.yml | 12 +++--- .gitignore | 1 + composer.json | 2 +- phpunit.xml.dist | 39 ++++++++++--------- tests/Monolog/ErrorHandlerTest.php | 2 +- tests/Monolog/Formatter/JsonFormatterTest.php | 2 +- tests/Monolog/Formatter/LineFormatterTest.php | 10 ++--- .../Formatter/MongoDBFormatterTest.php | 2 +- .../Monolog/Formatter/SyslogFormatterTest.php | 2 +- tests/Monolog/Handler/ElasticaHandlerTest.php | 2 +- .../Handler/ElasticsearchHandlerTest.php | 2 +- tests/Monolog/Handler/HandlerWrapperTest.php | 2 +- tests/Monolog/Handler/NoopHandlerTest.php | 2 +- tests/Monolog/Handler/ProcessHandlerTest.php | 15 +++++-- tests/Monolog/Handler/PsrHandlerTest.php | 2 +- .../Handler/RotatingFileHandlerTest.php | 12 +++--- .../Monolog/Handler/Slack/SlackRecordTest.php | 4 +- tests/Monolog/Handler/SlackHandlerTest.php | 2 +- tests/Monolog/Handler/StreamHandlerTest.php | 6 +-- .../Monolog/Handler/SyslogUdpHandlerTest.php | 32 ++++++++++----- tests/Monolog/Handler/TestHandlerTest.php | 2 +- tests/Monolog/LoggerTest.php | 6 +-- .../Processor/ClosureContextProcessorTest.php | 2 +- .../Processor/PsrLogMessageProcessorTest.php | 2 +- tests/Monolog/PsrLogCompatTest.php | 2 +- tests/Monolog/RegistryTest.php | 4 +- tests/Monolog/SignalHandlerTest.php | 8 ++-- tests/Monolog/UtilsTest.php | 12 +++--- 28 files changed, 106 insertions(+), 85 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index af3e251e..a0d13aef 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -77,7 +77,7 @@ jobs: composer-options: "${{ matrix.composer-options }}" - name: "Run tests" - run: "composer exec phpunit -- --exclude-group Elasticsearch,Elastica --verbose" + run: "composer exec phpunit -- --exclude-group Elasticsearch,Elastica" - name: "Run tests with psr/log 3" if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" @@ -85,7 +85,7 @@ jobs: composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar composer require --no-update psr/log:^3 composer update ${{ matrix.composer-options }} - composer exec phpunit -- --exclude-group Elasticsearch,Elastica --verbose + composer exec phpunit -- --exclude-group Elasticsearch,Elastica tests-es-7: name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}" @@ -152,7 +152,7 @@ jobs: dependency-versions: "${{ matrix.dependencies }}" - name: "Run tests" - run: "composer exec phpunit -- --group Elasticsearch,Elastica --verbose" + run: "composer exec phpunit -- --group Elasticsearch,Elastica" - name: "Run tests with psr/log 3" if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" @@ -161,7 +161,7 @@ jobs: composer require --no-update --no-interaction --dev ruflin/elastica elasticsearch/elasticsearch:^7 composer require --no-update psr/log:^3 composer update -W - composer exec phpunit -- --group Elasticsearch,Elastica --verbose + composer exec phpunit -- --group Elasticsearch,Elastica tests-es-8: name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}" @@ -230,11 +230,11 @@ jobs: dependency-versions: "${{ matrix.dependencies }}" - name: "Run tests" - run: "composer exec phpunit -- --group Elasticsearch,Elastica --verbose" + run: "composer exec phpunit -- --group Elasticsearch,Elastica" - name: "Run tests with psr/log 3" if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" run: | composer require --no-update psr/log:^3 composer update -W - composer exec phpunit -- --group Elasticsearch,Elastica --verbose + composer exec phpunit -- --group Elasticsearch,Elastica diff --git a/.gitignore b/.gitignore index 9418cccf..353c252d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ composer.lock .php-cs-fixer.cache .hg .phpunit.result.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 19c7b735..4ccd0721 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "phpstan/phpstan": "^1.9", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "^9.5.26", + "phpunit/phpunit": "^10.1", "predis/predis": "^1.1 || ^2", "ruflin/elastica": "^7", "symfony/mailer": "^5.4 || ^6", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a45c3eb8..087cd6b9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,25 @@ + + + + tests/Monolog/ + + - - - - tests/Monolog/ - - + - - - src/Monolog/ - - + + + + + + + src/Monolog/ + + - - - diff --git a/tests/Monolog/ErrorHandlerTest.php b/tests/Monolog/ErrorHandlerTest.php index 01f87545..6ff6431f 100644 --- a/tests/Monolog/ErrorHandlerTest.php +++ b/tests/Monolog/ErrorHandlerTest.php @@ -51,7 +51,7 @@ class ErrorHandlerTest extends \PHPUnit\Framework\TestCase } } - public function fatalHandlerProvider() + public static function fatalHandlerProvider() { return [ [null, 10, str_repeat(' ', 1024 * 10), LogLevel::ALERT], diff --git a/tests/Monolog/Formatter/JsonFormatterTest.php b/tests/Monolog/Formatter/JsonFormatterTest.php index 42936e1f..ebd4ae4d 100644 --- a/tests/Monolog/Formatter/JsonFormatterTest.php +++ b/tests/Monolog/Formatter/JsonFormatterTest.php @@ -327,7 +327,7 @@ class TestJsonNormPrivate class TestJsonNormWithToStringAndJson implements JsonSerializable { - public function jsonSerialize() + public function jsonSerialize(): mixed { return ['json serialized']; } diff --git a/tests/Monolog/Formatter/LineFormatterTest.php b/tests/Monolog/Formatter/LineFormatterTest.php index 02c38a40..466419fb 100644 --- a/tests/Monolog/Formatter/LineFormatterTest.php +++ b/tests/Monolog/Formatter/LineFormatterTest.php @@ -160,15 +160,15 @@ class LineFormatterTest extends TestCase $trace = explode('[stacktrace]', $message, 2)[1]; - $this->assertStringContainsString('TestCase.php', $trace); - $this->assertStringContainsString('TestResult.php', $trace); + $this->assertStringContainsString('TestSuite.php', $trace); + $this->assertStringContainsString('TestRunner.php', $trace); } public function testDefFormatWithExceptionAndStacktraceParserCustom() { $formatter = new LineFormatter(null, 'Y-m-d'); $formatter->includeStacktraces(true, function ($line) { - if (strpos($line, 'TestCase.php') === false) { + if (strpos($line, 'TestSuite.php') === false) { return $line; } }); @@ -177,8 +177,8 @@ class LineFormatterTest extends TestCase $trace = explode('[stacktrace]', $message, 2)[1]; - $this->assertStringNotContainsString('TestCase.php', $trace); - $this->assertStringContainsString('TestResult.php', $trace); + $this->assertStringNotContainsString('TestSuite.php', $trace); + $this->assertStringContainsString('TestRunner.php', $trace); } public function testDefFormatWithExceptionAndStacktraceParserEmpty() diff --git a/tests/Monolog/Formatter/MongoDBFormatterTest.php b/tests/Monolog/Formatter/MongoDBFormatterTest.php index 9a712e54..a1b1fce0 100644 --- a/tests/Monolog/Formatter/MongoDBFormatterTest.php +++ b/tests/Monolog/Formatter/MongoDBFormatterTest.php @@ -29,7 +29,7 @@ class MongoDBFormatterTest extends TestCase } } - public function constructArgumentProvider() + public static function constructArgumentProvider() { return [ [1, true, 1, true], diff --git a/tests/Monolog/Formatter/SyslogFormatterTest.php b/tests/Monolog/Formatter/SyslogFormatterTest.php index fe8933ea..7d0fdc61 100644 --- a/tests/Monolog/Formatter/SyslogFormatterTest.php +++ b/tests/Monolog/Formatter/SyslogFormatterTest.php @@ -64,7 +64,7 @@ class SyslogFormatterTest extends TestCase /** * @return mixed[] */ - public function formatDataProvider(): array + public static function formatDataProvider(): array { return [ 'error' => [ diff --git a/tests/Monolog/Handler/ElasticaHandlerTest.php b/tests/Monolog/Handler/ElasticaHandlerTest.php index 6cc705d4..a97a8cf4 100644 --- a/tests/Monolog/Handler/ElasticaHandlerTest.php +++ b/tests/Monolog/Handler/ElasticaHandlerTest.php @@ -146,7 +146,7 @@ class ElasticaHandlerTest extends TestCase } } - public function providerTestConnectionErrors(): array + public static function providerTestConnectionErrors(): array { return [ [false, ['RuntimeException', 'Error sending messages to Elasticsearch']], diff --git a/tests/Monolog/Handler/ElasticsearchHandlerTest.php b/tests/Monolog/Handler/ElasticsearchHandlerTest.php index 37300e5a..cd2cf7b9 100644 --- a/tests/Monolog/Handler/ElasticsearchHandlerTest.php +++ b/tests/Monolog/Handler/ElasticsearchHandlerTest.php @@ -128,7 +128,7 @@ class ElasticsearchHandlerTest extends TestCase } } - public function providerTestConnectionErrors(): array + public static function providerTestConnectionErrors(): array { return [ [false, ['RuntimeException', 'Error sending messages to Elasticsearch']], diff --git a/tests/Monolog/Handler/HandlerWrapperTest.php b/tests/Monolog/Handler/HandlerWrapperTest.php index 7212081e..f5c92464 100644 --- a/tests/Monolog/Handler/HandlerWrapperTest.php +++ b/tests/Monolog/Handler/HandlerWrapperTest.php @@ -37,7 +37,7 @@ class HandlerWrapperTest extends TestCase unset($this->wrapper); } - public function trueFalseDataProvider(): array + public static function trueFalseDataProvider(): array { return [ [true], diff --git a/tests/Monolog/Handler/NoopHandlerTest.php b/tests/Monolog/Handler/NoopHandlerTest.php index 83cb6a2a..0546c0c9 100644 --- a/tests/Monolog/Handler/NoopHandlerTest.php +++ b/tests/Monolog/Handler/NoopHandlerTest.php @@ -37,7 +37,7 @@ class NoopHandlerTest extends TestCase $this->assertFalse($handler->handle($this->getRecord($level))); } - public function logLevelsProvider() + public static function logLevelsProvider() { return array_map( fn ($level) => [$level], diff --git a/tests/Monolog/Handler/ProcessHandlerTest.php b/tests/Monolog/Handler/ProcessHandlerTest.php index 38eb3195..bf3c9075 100644 --- a/tests/Monolog/Handler/ProcessHandlerTest.php +++ b/tests/Monolog/Handler/ProcessHandlerTest.php @@ -46,9 +46,16 @@ class ProcessHandlerTest extends TestCase $handler = $mockBuilder->getMock(); - $handler->expects($this->exactly(2)) + $matcher = $this->exactly(2); + $handler->expects($matcher) ->method('writeProcessInput') - ->withConsecutive([$this->stringContains($fixtures[0])], [$this->stringContains($fixtures[1])]); + ->willReturnCallback(function () use ($matcher, $fixtures) { + match ($matcher->numberOfInvocations()) { + 1 => $this->stringContains($fixtures[0]), + 2 => $this->stringContains($fixtures[1]), + }; + }) + ; /** @var ProcessHandler $handler */ $handler->handle($this->getRecord(Level::Warning, $fixtures[0])); @@ -58,7 +65,7 @@ class ProcessHandlerTest extends TestCase /** * Data provider for invalid commands. */ - public function invalidCommandProvider(): array + public static function invalidCommandProvider(): array { return [ [1337, 'TypeError'], @@ -82,7 +89,7 @@ class ProcessHandlerTest extends TestCase /** * Data provider for invalid CWDs. */ - public function invalidCwdProvider(): array + public static function invalidCwdProvider(): array { return [ [1337, 'TypeError'], diff --git a/tests/Monolog/Handler/PsrHandlerTest.php b/tests/Monolog/Handler/PsrHandlerTest.php index 73d4d923..d6fa6fb3 100644 --- a/tests/Monolog/Handler/PsrHandlerTest.php +++ b/tests/Monolog/Handler/PsrHandlerTest.php @@ -20,7 +20,7 @@ use Monolog\Formatter\LineFormatter; */ class PsrHandlerTest extends TestCase { - public function logLevelProvider() + public static function logLevelProvider() { return array_map( fn (Level $level) => [$level->toPsrLogLevel(), $level], diff --git a/tests/Monolog/Handler/RotatingFileHandlerTest.php b/tests/Monolog/Handler/RotatingFileHandlerTest.php index 4294b7f3..7611a53f 100644 --- a/tests/Monolog/Handler/RotatingFileHandlerTest.php +++ b/tests/Monolog/Handler/RotatingFileHandlerTest.php @@ -47,7 +47,7 @@ class RotatingFileHandlerTest extends TestCase unlink($file); } - if ('testRotationWithFolderByDate' === $this->getName(false)) { + if ('testRotationWithFolderByDate' === $this->name()) { foreach (glob(__DIR__.'/Fixtures/[0-9]*') as $folder) { $this->rrmdir($folder); } @@ -137,7 +137,7 @@ class RotatingFileHandlerTest extends TestCase $this->assertEquals('test', file_get_contents($log)); } - public function rotationTests() + public static function rotationTests() { $now = time(); $dayCallback = function ($ago) use ($now) { @@ -207,7 +207,7 @@ class RotatingFileHandlerTest extends TestCase $this->assertEquals('test', file_get_contents($log)); } - public function rotationWithFolderByDateTests() + public static function rotationWithFolderByDateTests() { $now = time(); $dayCallback = function ($ago) use ($now) { @@ -252,7 +252,7 @@ class RotatingFileHandlerTest extends TestCase $this->assertTrue(true); } - public function dateFormatProvider() + public static function dateFormatProvider() { return [ [RotatingFileHandler::FILE_PER_DAY, true], @@ -293,7 +293,7 @@ class RotatingFileHandlerTest extends TestCase $handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY); } - public function filenameFormatProvider() + public static function filenameFormatProvider() { return [ ['{filename}', false], @@ -326,7 +326,7 @@ class RotatingFileHandlerTest extends TestCase $this->assertTrue(file_exists($log)); } - public function rotationWhenSimilarFilesExistTests() + public static function rotationWhenSimilarFilesExistTests() { return [ 'Rotation is triggered when the file of the current day is not present but similar exists' diff --git a/tests/Monolog/Handler/Slack/SlackRecordTest.php b/tests/Monolog/Handler/Slack/SlackRecordTest.php index b19a1b63..d59de177 100644 --- a/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ b/tests/Monolog/Handler/Slack/SlackRecordTest.php @@ -19,7 +19,7 @@ use Monolog\Test\TestCase; */ class SlackRecordTest extends TestCase { - public function dataGetAttachmentColor() + public static function dataGetAttachmentColor() { return [ [Level::Debug, SlackRecord::COLOR_DEFAULT], @@ -64,7 +64,7 @@ class SlackRecordTest extends TestCase $this->assertArrayNotHasKey('username', $data); } - public function dataStringify(): array + public static function dataStringify(): array { $multipleDimensions = [[1, 2]]; $numericKeys = ['library' => 'monolog']; diff --git a/tests/Monolog/Handler/SlackHandlerTest.php b/tests/Monolog/Handler/SlackHandlerTest.php index 6d1bbb13..7832739f 100644 --- a/tests/Monolog/Handler/SlackHandlerTest.php +++ b/tests/Monolog/Handler/SlackHandlerTest.php @@ -116,7 +116,7 @@ class SlackHandlerTest extends TestCase $this->assertMatchesRegularExpression('/text=test1/', $content); } - public function provideLevelColors() + public static function provideLevelColors() { return [ [Level::Debug, urlencode(SlackRecord::COLOR_DEFAULT)], diff --git a/tests/Monolog/Handler/StreamHandlerTest.php b/tests/Monolog/Handler/StreamHandlerTest.php index 2d93b30c..4b5cea1f 100644 --- a/tests/Monolog/Handler/StreamHandlerTest.php +++ b/tests/Monolog/Handler/StreamHandlerTest.php @@ -117,7 +117,7 @@ class StreamHandlerTest extends TestCase $handler->handle($this->getRecord()); } - public function invalidArgumentProvider() + public static function invalidArgumentProvider() { return [ [1], @@ -232,7 +232,7 @@ STRING; $handler->handle($this->getRecord()); } - public function provideNonExistingAndNotCreatablePath() + public static function provideNonExistingAndNotCreatablePath() { return [ '/foo/bar/…' => [ @@ -244,7 +244,7 @@ STRING; ]; } - public function provideMemoryValues() + public static function provideMemoryValues() { return [ ['1M', (int) (1024*1024/10)], diff --git a/tests/Monolog/Handler/SyslogUdpHandlerTest.php b/tests/Monolog/Handler/SyslogUdpHandlerTest.php index f27d5ad5..834225d9 100644 --- a/tests/Monolog/Handler/SyslogUdpHandlerTest.php +++ b/tests/Monolog/Handler/SyslogUdpHandlerTest.php @@ -39,12 +39,18 @@ class SyslogUdpHandlerTest extends TestCase ->onlyMethods(['write']) ->setConstructorArgs(['lol']) ->getMock(); - $socket->expects($this->atLeast(2)) + + $matcher = $this->atLeast(2); + + $socket->expects($matcher) ->method('write') - ->withConsecutive( - [$this->equalTo("lol"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ")], - [$this->equalTo("hej"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ")], - ); + ->willReturnCallback(function () use ($matcher, $time, $host, $pid) { + match ($matcher->numberOfInvocations()) { + 1 => $this->equalTo("lol") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "), + 2 => $this->equalTo("hej") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - "), + default => $this->assertTrue(true) + }; + }); $handler->setSocket($socket); @@ -85,12 +91,18 @@ class SyslogUdpHandlerTest extends TestCase ->setConstructorArgs(['lol', 999]) ->onlyMethods(['write']) ->getMock(); - $socket->expects($this->atLeast(2)) + + $matcher = $this->atLeast(2); + + $socket->expects($matcher) ->method('write') - ->withConsecutive( - [$this->equalTo("lol"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ")], - [$this->equalTo("hej"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ")], - ); + ->willReturnCallback(function () use ($matcher, $time, $host, $pid) { + match ($matcher->numberOfInvocations()) { + 1 => $this->equalTo("lol") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: "), + 2 => $this->equalTo("hej") && $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: "), + default => $this->assertTrue(true) + }; + }); $handler->setSocket($socket); diff --git a/tests/Monolog/Handler/TestHandlerTest.php b/tests/Monolog/Handler/TestHandlerTest.php index 218d111c..4ce7f1be 100644 --- a/tests/Monolog/Handler/TestHandlerTest.php +++ b/tests/Monolog/Handler/TestHandlerTest.php @@ -102,7 +102,7 @@ class TestHandlerTest extends TestCase ])); } - public function methodProvider() + public static function methodProvider() { return [ ['Emergency', Level::Emergency], diff --git a/tests/Monolog/LoggerTest.php b/tests/Monolog/LoggerTest.php index a8a28a5e..1b81893a 100644 --- a/tests/Monolog/LoggerTest.php +++ b/tests/Monolog/LoggerTest.php @@ -517,7 +517,7 @@ class LoggerTest extends TestCase $this->assertEquals($expectedLevel, $record->level); } - public function logMethodProvider() + public static function logMethodProvider() { return [ // PSR-3 methods @@ -547,7 +547,7 @@ class LoggerTest extends TestCase $this->assertEquals($tz, $record->datetime->getTimezone()); } - public function setTimezoneProvider() + public static function setTimezoneProvider() { return array_map( function ($tz) { @@ -628,7 +628,7 @@ class LoggerTest extends TestCase $this->assertSame($record->datetime->format($assertFormat), (string) $record->datetime); } - public function useMicrosecondTimestampsProvider() + public static function useMicrosecondTimestampsProvider() { return [ // this has a very small chance of a false negative (1/10^6) diff --git a/tests/Monolog/Processor/ClosureContextProcessorTest.php b/tests/Monolog/Processor/ClosureContextProcessorTest.php index 68a9e729..134a992b 100644 --- a/tests/Monolog/Processor/ClosureContextProcessorTest.php +++ b/tests/Monolog/Processor/ClosureContextProcessorTest.php @@ -57,7 +57,7 @@ class ClosureContextProcessorTest extends TestCase $this->assertSame($expected, $record->context); } - public function getContexts(): iterable + public static function getContexts(): iterable { yield [['foo']]; yield [['foo' => 'bar']]; diff --git a/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/tests/Monolog/Processor/PsrLogMessageProcessorTest.php index ab1ce52f..2735935d 100644 --- a/tests/Monolog/Processor/PsrLogMessageProcessorTest.php +++ b/tests/Monolog/Processor/PsrLogMessageProcessorTest.php @@ -49,7 +49,7 @@ class PsrLogMessageProcessorTest extends TestCase $this->assertSame(['foo' => $date], $message['context']); } - public function getPairs() + public static function getPairs() { $date = new \DateTime(); diff --git a/tests/Monolog/PsrLogCompatTest.php b/tests/Monolog/PsrLogCompatTest.php index 45f4f5e4..a1f523ac 100644 --- a/tests/Monolog/PsrLogCompatTest.php +++ b/tests/Monolog/PsrLogCompatTest.php @@ -79,7 +79,7 @@ class PsrLogCompatTest extends TestCase $this->assertEquals($expected, $this->getLogs()); } - public function provideLevelsAndMessages() + public static function provideLevelsAndMessages() { return [ LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'], diff --git a/tests/Monolog/RegistryTest.php b/tests/Monolog/RegistryTest.php index 3ebfe841..cacf7855 100644 --- a/tests/Monolog/RegistryTest.php +++ b/tests/Monolog/RegistryTest.php @@ -32,7 +32,7 @@ class RegistryTest extends \PHPUnit\Framework\TestCase } } - public function hasLoggerProvider() + public static function hasLoggerProvider() { $logger1 = new Logger('test1'); $logger2 = new Logger('test2'); @@ -86,7 +86,7 @@ class RegistryTest extends \PHPUnit\Framework\TestCase Registry::getInstance($loggerToAdd->getName()); } - public function removedLoggerProvider() + public static function removedLoggerProvider() { $logger1 = new Logger('test1'); diff --git a/tests/Monolog/SignalHandlerTest.php b/tests/Monolog/SignalHandlerTest.php index 18ff3780..addcb8c1 100644 --- a/tests/Monolog/SignalHandlerTest.php +++ b/tests/Monolog/SignalHandlerTest.php @@ -159,7 +159,7 @@ class SignalHandlerTest extends TestCase $this->assertSame($expected, file_get_contents($path)); } - public function defaultPreviousProvider() + public static function defaultPreviousProvider() { if (!defined('SIGCONT') || !defined('SIGINT') || !defined('SIGURG')) { return []; @@ -196,7 +196,7 @@ class SignalHandlerTest extends TestCase $this->assertSame($callPrevious ? 1 : 0, $previousCalled); } - public function callablePreviousProvider() + public static function callablePreviousProvider() { return [ [false], @@ -248,7 +248,7 @@ class SignalHandlerTest extends TestCase } } - public function restartSyscallsProvider() + public static function restartSyscallsProvider() { return [ [false], @@ -277,7 +277,7 @@ class SignalHandlerTest extends TestCase $this->assertCount($expectedAfter, $handler->getRecords()); } - public function asyncProvider() + public static function asyncProvider() { return [ [false, false, 0, 1], diff --git a/tests/Monolog/UtilsTest.php b/tests/Monolog/UtilsTest.php index 60a66212..d6e48ed9 100644 --- a/tests/Monolog/UtilsTest.php +++ b/tests/Monolog/UtilsTest.php @@ -21,7 +21,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase $this->assertSame($expected, Utils::getClass($object)); } - public function provideObjects() + public static function provideObjects() { return [ ['stdClass', new \stdClass()], @@ -40,7 +40,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase $this->assertSame($expected, Utils::canonicalizePath($input)); } - public function providePathsToCanonicalize() + public static function providePathsToCanonicalize() { return [ ['/foo/bar', '/foo/bar'], @@ -62,7 +62,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase Utils::handleJsonError($code, 'faked'); } - public function providesHandleJsonErrorFailure() + public static function providesHandleJsonErrorFailure() { return [ 'depth' => [JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'], @@ -87,7 +87,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase $this->assertSame($expect, $in); } - public function providesDetectAndCleanUtf8() + public static function providesDetectAndCleanUtf8() { $obj = new \stdClass; @@ -123,7 +123,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase /** * @return array[] */ - public function providesPcreLastErrorMessage(): array + public static function providesPcreLastErrorMessage(): array { return [ [0, 'PREG_NO_ERROR'], @@ -137,7 +137,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase ]; } - public function provideIniValuesToConvertToBytes() + public static function provideIniValuesToConvertToBytes() { return [ ['1', 1],