1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-09 06:36:46 +02:00

Upgrade to phpunit 10 (#1806)

Co-authored-by: Christopher Georg <christopher.georg@sr-travel.de>
This commit is contained in:
chris
2023-06-20 15:56:11 +02:00
committed by GitHub
parent 50409b8169
commit 8561130215
28 changed files with 106 additions and 85 deletions

View File

@@ -77,7 +77,7 @@ jobs:
composer-options: "${{ matrix.composer-options }}" composer-options: "${{ matrix.composer-options }}"
- name: "Run tests" - 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" - name: "Run tests with psr/log 3"
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" 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 remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar
composer require --no-update psr/log:^3 composer require --no-update psr/log:^3
composer update ${{ matrix.composer-options }} composer update ${{ matrix.composer-options }}
composer exec phpunit -- --exclude-group Elasticsearch,Elastica --verbose composer exec phpunit -- --exclude-group Elasticsearch,Elastica
tests-es-7: tests-es-7:
name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}" name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}"
@@ -152,7 +152,7 @@ jobs:
dependency-versions: "${{ matrix.dependencies }}" dependency-versions: "${{ matrix.dependencies }}"
- name: "Run tests" - 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" - name: "Run tests with psr/log 3"
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" 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 --no-interaction --dev ruflin/elastica elasticsearch/elasticsearch:^7
composer require --no-update psr/log:^3 composer require --no-update psr/log:^3
composer update -W composer update -W
composer exec phpunit -- --group Elasticsearch,Elastica --verbose composer exec phpunit -- --group Elasticsearch,Elastica
tests-es-8: tests-es-8:
name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}" name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}"
@@ -230,11 +230,11 @@ jobs:
dependency-versions: "${{ matrix.dependencies }}" dependency-versions: "${{ matrix.dependencies }}"
- name: "Run tests" - 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" - name: "Run tests with psr/log 3"
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'" if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
run: | run: |
composer require --no-update psr/log:^3 composer require --no-update psr/log:^3
composer update -W composer update -W
composer exec phpunit -- --group Elasticsearch,Elastica --verbose composer exec phpunit -- --group Elasticsearch,Elastica

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ composer.lock
.php-cs-fixer.cache .php-cs-fixer.cache
.hg .hg
.phpunit.result.cache .phpunit.result.cache
.phpunit.cache

View File

@@ -29,7 +29,7 @@
"phpstan/phpstan": "^1.9", "phpstan/phpstan": "^1.9",
"phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-strict-rules": "^1.4", "phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^9.5.26", "phpunit/phpunit": "^10.1",
"predis/predis": "^1.1 || ^2", "predis/predis": "^1.1 || ^2",
"ruflin/elastica": "^7", "ruflin/elastica": "^7",
"symfony/mailer": "^5.4 || ^6", "symfony/mailer": "^5.4 || ^6",

View File

@@ -1,24 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
colors="true"
beStrictAboutTestsThatDoNotTestAnything="false">
<testsuites>
<testsuite name="Monolog Test Suite">
<directory>tests/Monolog/</directory>
</testsuite>
</testsuites>
<phpunit <coverage/>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="false"
>
<testsuites>
<testsuite name="Monolog Test Suite">
<directory>tests/Monolog/</directory>
</testsuite>
</testsuites>
<coverage> <php>
<include> <ini name="date.timezone" value="UTC"/>
<directory suffix=".php">src/Monolog/</directory> </php>
</include>
</coverage> <source>
<include>
<directory suffix=".php">src/Monolog/</directory>
</include>
</source>
<php>
<ini name="date.timezone" value="UTC"/>
</php>
</phpunit> </phpunit>

View File

@@ -51,7 +51,7 @@ class ErrorHandlerTest extends \PHPUnit\Framework\TestCase
} }
} }
public function fatalHandlerProvider() public static function fatalHandlerProvider()
{ {
return [ return [
[null, 10, str_repeat(' ', 1024 * 10), LogLevel::ALERT], [null, 10, str_repeat(' ', 1024 * 10), LogLevel::ALERT],

View File

@@ -327,7 +327,7 @@ class TestJsonNormPrivate
class TestJsonNormWithToStringAndJson implements JsonSerializable class TestJsonNormWithToStringAndJson implements JsonSerializable
{ {
public function jsonSerialize() public function jsonSerialize(): mixed
{ {
return ['json serialized']; return ['json serialized'];
} }

View File

@@ -160,15 +160,15 @@ class LineFormatterTest extends TestCase
$trace = explode('[stacktrace]', $message, 2)[1]; $trace = explode('[stacktrace]', $message, 2)[1];
$this->assertStringContainsString('TestCase.php', $trace); $this->assertStringContainsString('TestSuite.php', $trace);
$this->assertStringContainsString('TestResult.php', $trace); $this->assertStringContainsString('TestRunner.php', $trace);
} }
public function testDefFormatWithExceptionAndStacktraceParserCustom() public function testDefFormatWithExceptionAndStacktraceParserCustom()
{ {
$formatter = new LineFormatter(null, 'Y-m-d'); $formatter = new LineFormatter(null, 'Y-m-d');
$formatter->includeStacktraces(true, function ($line) { $formatter->includeStacktraces(true, function ($line) {
if (strpos($line, 'TestCase.php') === false) { if (strpos($line, 'TestSuite.php') === false) {
return $line; return $line;
} }
}); });
@@ -177,8 +177,8 @@ class LineFormatterTest extends TestCase
$trace = explode('[stacktrace]', $message, 2)[1]; $trace = explode('[stacktrace]', $message, 2)[1];
$this->assertStringNotContainsString('TestCase.php', $trace); $this->assertStringNotContainsString('TestSuite.php', $trace);
$this->assertStringContainsString('TestResult.php', $trace); $this->assertStringContainsString('TestRunner.php', $trace);
} }
public function testDefFormatWithExceptionAndStacktraceParserEmpty() public function testDefFormatWithExceptionAndStacktraceParserEmpty()

View File

@@ -29,7 +29,7 @@ class MongoDBFormatterTest extends TestCase
} }
} }
public function constructArgumentProvider() public static function constructArgumentProvider()
{ {
return [ return [
[1, true, 1, true], [1, true, 1, true],

View File

@@ -64,7 +64,7 @@ class SyslogFormatterTest extends TestCase
/** /**
* @return mixed[] * @return mixed[]
*/ */
public function formatDataProvider(): array public static function formatDataProvider(): array
{ {
return [ return [
'error' => [ 'error' => [

View File

@@ -146,7 +146,7 @@ class ElasticaHandlerTest extends TestCase
} }
} }
public function providerTestConnectionErrors(): array public static function providerTestConnectionErrors(): array
{ {
return [ return [
[false, ['RuntimeException', 'Error sending messages to Elasticsearch']], [false, ['RuntimeException', 'Error sending messages to Elasticsearch']],

View File

@@ -128,7 +128,7 @@ class ElasticsearchHandlerTest extends TestCase
} }
} }
public function providerTestConnectionErrors(): array public static function providerTestConnectionErrors(): array
{ {
return [ return [
[false, ['RuntimeException', 'Error sending messages to Elasticsearch']], [false, ['RuntimeException', 'Error sending messages to Elasticsearch']],

View File

@@ -37,7 +37,7 @@ class HandlerWrapperTest extends TestCase
unset($this->wrapper); unset($this->wrapper);
} }
public function trueFalseDataProvider(): array public static function trueFalseDataProvider(): array
{ {
return [ return [
[true], [true],

View File

@@ -37,7 +37,7 @@ class NoopHandlerTest extends TestCase
$this->assertFalse($handler->handle($this->getRecord($level))); $this->assertFalse($handler->handle($this->getRecord($level)));
} }
public function logLevelsProvider() public static function logLevelsProvider()
{ {
return array_map( return array_map(
fn ($level) => [$level], fn ($level) => [$level],

View File

@@ -46,9 +46,16 @@ class ProcessHandlerTest extends TestCase
$handler = $mockBuilder->getMock(); $handler = $mockBuilder->getMock();
$handler->expects($this->exactly(2)) $matcher = $this->exactly(2);
$handler->expects($matcher)
->method('writeProcessInput') ->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 */ /** @var ProcessHandler $handler */
$handler->handle($this->getRecord(Level::Warning, $fixtures[0])); $handler->handle($this->getRecord(Level::Warning, $fixtures[0]));
@@ -58,7 +65,7 @@ class ProcessHandlerTest extends TestCase
/** /**
* Data provider for invalid commands. * Data provider for invalid commands.
*/ */
public function invalidCommandProvider(): array public static function invalidCommandProvider(): array
{ {
return [ return [
[1337, 'TypeError'], [1337, 'TypeError'],
@@ -82,7 +89,7 @@ class ProcessHandlerTest extends TestCase
/** /**
* Data provider for invalid CWDs. * Data provider for invalid CWDs.
*/ */
public function invalidCwdProvider(): array public static function invalidCwdProvider(): array
{ {
return [ return [
[1337, 'TypeError'], [1337, 'TypeError'],

View File

@@ -20,7 +20,7 @@ use Monolog\Formatter\LineFormatter;
*/ */
class PsrHandlerTest extends TestCase class PsrHandlerTest extends TestCase
{ {
public function logLevelProvider() public static function logLevelProvider()
{ {
return array_map( return array_map(
fn (Level $level) => [$level->toPsrLogLevel(), $level], fn (Level $level) => [$level->toPsrLogLevel(), $level],

View File

@@ -47,7 +47,7 @@ class RotatingFileHandlerTest extends TestCase
unlink($file); unlink($file);
} }
if ('testRotationWithFolderByDate' === $this->getName(false)) { if ('testRotationWithFolderByDate' === $this->name()) {
foreach (glob(__DIR__.'/Fixtures/[0-9]*') as $folder) { foreach (glob(__DIR__.'/Fixtures/[0-9]*') as $folder) {
$this->rrmdir($folder); $this->rrmdir($folder);
} }
@@ -137,7 +137,7 @@ class RotatingFileHandlerTest extends TestCase
$this->assertEquals('test', file_get_contents($log)); $this->assertEquals('test', file_get_contents($log));
} }
public function rotationTests() public static function rotationTests()
{ {
$now = time(); $now = time();
$dayCallback = function ($ago) use ($now) { $dayCallback = function ($ago) use ($now) {
@@ -207,7 +207,7 @@ class RotatingFileHandlerTest extends TestCase
$this->assertEquals('test', file_get_contents($log)); $this->assertEquals('test', file_get_contents($log));
} }
public function rotationWithFolderByDateTests() public static function rotationWithFolderByDateTests()
{ {
$now = time(); $now = time();
$dayCallback = function ($ago) use ($now) { $dayCallback = function ($ago) use ($now) {
@@ -252,7 +252,7 @@ class RotatingFileHandlerTest extends TestCase
$this->assertTrue(true); $this->assertTrue(true);
} }
public function dateFormatProvider() public static function dateFormatProvider()
{ {
return [ return [
[RotatingFileHandler::FILE_PER_DAY, true], [RotatingFileHandler::FILE_PER_DAY, true],
@@ -293,7 +293,7 @@ class RotatingFileHandlerTest extends TestCase
$handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY); $handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
} }
public function filenameFormatProvider() public static function filenameFormatProvider()
{ {
return [ return [
['{filename}', false], ['{filename}', false],
@@ -326,7 +326,7 @@ class RotatingFileHandlerTest extends TestCase
$this->assertTrue(file_exists($log)); $this->assertTrue(file_exists($log));
} }
public function rotationWhenSimilarFilesExistTests() public static function rotationWhenSimilarFilesExistTests()
{ {
return [ return [
'Rotation is triggered when the file of the current day is not present but similar exists' 'Rotation is triggered when the file of the current day is not present but similar exists'

View File

@@ -19,7 +19,7 @@ use Monolog\Test\TestCase;
*/ */
class SlackRecordTest extends TestCase class SlackRecordTest extends TestCase
{ {
public function dataGetAttachmentColor() public static function dataGetAttachmentColor()
{ {
return [ return [
[Level::Debug, SlackRecord::COLOR_DEFAULT], [Level::Debug, SlackRecord::COLOR_DEFAULT],
@@ -64,7 +64,7 @@ class SlackRecordTest extends TestCase
$this->assertArrayNotHasKey('username', $data); $this->assertArrayNotHasKey('username', $data);
} }
public function dataStringify(): array public static function dataStringify(): array
{ {
$multipleDimensions = [[1, 2]]; $multipleDimensions = [[1, 2]];
$numericKeys = ['library' => 'monolog']; $numericKeys = ['library' => 'monolog'];

View File

@@ -116,7 +116,7 @@ class SlackHandlerTest extends TestCase
$this->assertMatchesRegularExpression('/text=test1/', $content); $this->assertMatchesRegularExpression('/text=test1/', $content);
} }
public function provideLevelColors() public static function provideLevelColors()
{ {
return [ return [
[Level::Debug, urlencode(SlackRecord::COLOR_DEFAULT)], [Level::Debug, urlencode(SlackRecord::COLOR_DEFAULT)],

View File

@@ -117,7 +117,7 @@ class StreamHandlerTest extends TestCase
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
public function invalidArgumentProvider() public static function invalidArgumentProvider()
{ {
return [ return [
[1], [1],
@@ -232,7 +232,7 @@ STRING;
$handler->handle($this->getRecord()); $handler->handle($this->getRecord());
} }
public function provideNonExistingAndNotCreatablePath() public static function provideNonExistingAndNotCreatablePath()
{ {
return [ return [
'/foo/bar/…' => [ '/foo/bar/…' => [
@@ -244,7 +244,7 @@ STRING;
]; ];
} }
public function provideMemoryValues() public static function provideMemoryValues()
{ {
return [ return [
['1M', (int) (1024*1024/10)], ['1M', (int) (1024*1024/10)],

View File

@@ -39,12 +39,18 @@ class SyslogUdpHandlerTest extends TestCase
->onlyMethods(['write']) ->onlyMethods(['write'])
->setConstructorArgs(['lol']) ->setConstructorArgs(['lol'])
->getMock(); ->getMock();
$socket->expects($this->atLeast(2))
$matcher = $this->atLeast(2);
$socket->expects($matcher)
->method('write') ->method('write')
->withConsecutive( ->willReturnCallback(function () use ($matcher, $time, $host, $pid) {
[$this->equalTo("lol"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ")], match ($matcher->numberOfInvocations()) {
[$this->equalTo("hej"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ")], 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); $handler->setSocket($socket);
@@ -85,12 +91,18 @@ class SyslogUdpHandlerTest extends TestCase
->setConstructorArgs(['lol', 999]) ->setConstructorArgs(['lol', 999])
->onlyMethods(['write']) ->onlyMethods(['write'])
->getMock(); ->getMock();
$socket->expects($this->atLeast(2))
$matcher = $this->atLeast(2);
$socket->expects($matcher)
->method('write') ->method('write')
->withConsecutive( ->willReturnCallback(function () use ($matcher, $time, $host, $pid) {
[$this->equalTo("lol"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ")], match ($matcher->numberOfInvocations()) {
[$this->equalTo("hej"), $this->equalTo("<".(LOG_AUTHPRIV + LOG_WARNING).">$time $host php[$pid]: ")], 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); $handler->setSocket($socket);

View File

@@ -102,7 +102,7 @@ class TestHandlerTest extends TestCase
])); ]));
} }
public function methodProvider() public static function methodProvider()
{ {
return [ return [
['Emergency', Level::Emergency], ['Emergency', Level::Emergency],

View File

@@ -517,7 +517,7 @@ class LoggerTest extends TestCase
$this->assertEquals($expectedLevel, $record->level); $this->assertEquals($expectedLevel, $record->level);
} }
public function logMethodProvider() public static function logMethodProvider()
{ {
return [ return [
// PSR-3 methods // PSR-3 methods
@@ -547,7 +547,7 @@ class LoggerTest extends TestCase
$this->assertEquals($tz, $record->datetime->getTimezone()); $this->assertEquals($tz, $record->datetime->getTimezone());
} }
public function setTimezoneProvider() public static function setTimezoneProvider()
{ {
return array_map( return array_map(
function ($tz) { function ($tz) {
@@ -628,7 +628,7 @@ class LoggerTest extends TestCase
$this->assertSame($record->datetime->format($assertFormat), (string) $record->datetime); $this->assertSame($record->datetime->format($assertFormat), (string) $record->datetime);
} }
public function useMicrosecondTimestampsProvider() public static function useMicrosecondTimestampsProvider()
{ {
return [ return [
// this has a very small chance of a false negative (1/10^6) // this has a very small chance of a false negative (1/10^6)

View File

@@ -57,7 +57,7 @@ class ClosureContextProcessorTest extends TestCase
$this->assertSame($expected, $record->context); $this->assertSame($expected, $record->context);
} }
public function getContexts(): iterable public static function getContexts(): iterable
{ {
yield [['foo']]; yield [['foo']];
yield [['foo' => 'bar']]; yield [['foo' => 'bar']];

View File

@@ -49,7 +49,7 @@ class PsrLogMessageProcessorTest extends TestCase
$this->assertSame(['foo' => $date], $message['context']); $this->assertSame(['foo' => $date], $message['context']);
} }
public function getPairs() public static function getPairs()
{ {
$date = new \DateTime(); $date = new \DateTime();

View File

@@ -79,7 +79,7 @@ class PsrLogCompatTest extends TestCase
$this->assertEquals($expected, $this->getLogs()); $this->assertEquals($expected, $this->getLogs());
} }
public function provideLevelsAndMessages() public static function provideLevelsAndMessages()
{ {
return [ return [
LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'], LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'],

View File

@@ -32,7 +32,7 @@ class RegistryTest extends \PHPUnit\Framework\TestCase
} }
} }
public function hasLoggerProvider() public static function hasLoggerProvider()
{ {
$logger1 = new Logger('test1'); $logger1 = new Logger('test1');
$logger2 = new Logger('test2'); $logger2 = new Logger('test2');
@@ -86,7 +86,7 @@ class RegistryTest extends \PHPUnit\Framework\TestCase
Registry::getInstance($loggerToAdd->getName()); Registry::getInstance($loggerToAdd->getName());
} }
public function removedLoggerProvider() public static function removedLoggerProvider()
{ {
$logger1 = new Logger('test1'); $logger1 = new Logger('test1');

View File

@@ -159,7 +159,7 @@ class SignalHandlerTest extends TestCase
$this->assertSame($expected, file_get_contents($path)); $this->assertSame($expected, file_get_contents($path));
} }
public function defaultPreviousProvider() public static function defaultPreviousProvider()
{ {
if (!defined('SIGCONT') || !defined('SIGINT') || !defined('SIGURG')) { if (!defined('SIGCONT') || !defined('SIGINT') || !defined('SIGURG')) {
return []; return [];
@@ -196,7 +196,7 @@ class SignalHandlerTest extends TestCase
$this->assertSame($callPrevious ? 1 : 0, $previousCalled); $this->assertSame($callPrevious ? 1 : 0, $previousCalled);
} }
public function callablePreviousProvider() public static function callablePreviousProvider()
{ {
return [ return [
[false], [false],
@@ -248,7 +248,7 @@ class SignalHandlerTest extends TestCase
} }
} }
public function restartSyscallsProvider() public static function restartSyscallsProvider()
{ {
return [ return [
[false], [false],
@@ -277,7 +277,7 @@ class SignalHandlerTest extends TestCase
$this->assertCount($expectedAfter, $handler->getRecords()); $this->assertCount($expectedAfter, $handler->getRecords());
} }
public function asyncProvider() public static function asyncProvider()
{ {
return [ return [
[false, false, 0, 1], [false, false, 0, 1],

View File

@@ -21,7 +21,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
$this->assertSame($expected, Utils::getClass($object)); $this->assertSame($expected, Utils::getClass($object));
} }
public function provideObjects() public static function provideObjects()
{ {
return [ return [
['stdClass', new \stdClass()], ['stdClass', new \stdClass()],
@@ -40,7 +40,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
$this->assertSame($expected, Utils::canonicalizePath($input)); $this->assertSame($expected, Utils::canonicalizePath($input));
} }
public function providePathsToCanonicalize() public static function providePathsToCanonicalize()
{ {
return [ return [
['/foo/bar', '/foo/bar'], ['/foo/bar', '/foo/bar'],
@@ -62,7 +62,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
Utils::handleJsonError($code, 'faked'); Utils::handleJsonError($code, 'faked');
} }
public function providesHandleJsonErrorFailure() public static function providesHandleJsonErrorFailure()
{ {
return [ return [
'depth' => [JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'], 'depth' => [JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'],
@@ -87,7 +87,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
$this->assertSame($expect, $in); $this->assertSame($expect, $in);
} }
public function providesDetectAndCleanUtf8() public static function providesDetectAndCleanUtf8()
{ {
$obj = new \stdClass; $obj = new \stdClass;
@@ -123,7 +123,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
/** /**
* @return array[] * @return array[]
*/ */
public function providesPcreLastErrorMessage(): array public static function providesPcreLastErrorMessage(): array
{ {
return [ return [
[0, 'PREG_NO_ERROR'], [0, 'PREG_NO_ERROR'],
@@ -137,7 +137,7 @@ class UtilsTest extends \PHPUnit_Framework_TestCase
]; ];
} }
public function provideIniValuesToConvertToBytes() public static function provideIniValuesToConvertToBytes()
{ {
return [ return [
['1', 1], ['1', 1],