Skip to content

Commit 8561130

Browse files
Upgrade to phpunit 10 (#1806)
Co-authored-by: Christopher Georg <christopher.georg@sr-travel.de>
1 parent 50409b8 commit 8561130

28 files changed

+106
-85
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ jobs:
7777
composer-options: "${{ matrix.composer-options }}"
7878

7979
- name: "Run tests"
80-
run: "composer exec phpunit -- --exclude-group Elasticsearch,Elastica --verbose"
80+
run: "composer exec phpunit -- --exclude-group Elasticsearch,Elastica"
8181

8282
- name: "Run tests with psr/log 3"
8383
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
8484
run: |
8585
composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar
8686
composer require --no-update psr/log:^3
8787
composer update ${{ matrix.composer-options }}
88-
composer exec phpunit -- --exclude-group Elasticsearch,Elastica --verbose
88+
composer exec phpunit -- --exclude-group Elasticsearch,Elastica
8989
9090
tests-es-7:
9191
name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}"
@@ -152,7 +152,7 @@ jobs:
152152
dependency-versions: "${{ matrix.dependencies }}"
153153

154154
- name: "Run tests"
155-
run: "composer exec phpunit -- --group Elasticsearch,Elastica --verbose"
155+
run: "composer exec phpunit -- --group Elasticsearch,Elastica"
156156

157157
- name: "Run tests with psr/log 3"
158158
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
@@ -161,7 +161,7 @@ jobs:
161161
composer require --no-update --no-interaction --dev ruflin/elastica elasticsearch/elasticsearch:^7
162162
composer require --no-update psr/log:^3
163163
composer update -W
164-
composer exec phpunit -- --group Elasticsearch,Elastica --verbose
164+
composer exec phpunit -- --group Elasticsearch,Elastica
165165
166166
tests-es-8:
167167
name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}"
@@ -230,11 +230,11 @@ jobs:
230230
dependency-versions: "${{ matrix.dependencies }}"
231231

232232
- name: "Run tests"
233-
run: "composer exec phpunit -- --group Elasticsearch,Elastica --verbose"
233+
run: "composer exec phpunit -- --group Elasticsearch,Elastica"
234234

235235
- name: "Run tests with psr/log 3"
236236
if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
237237
run: |
238238
composer require --no-update psr/log:^3
239239
composer update -W
240-
composer exec phpunit -- --group Elasticsearch,Elastica --verbose
240+
composer exec phpunit -- --group Elasticsearch,Elastica

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.lock
66
.php-cs-fixer.cache
77
.hg
88
.phpunit.result.cache
9+
.phpunit.cache

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"phpstan/phpstan": "^1.9",
3030
"phpstan/phpstan-deprecation-rules": "^1.0",
3131
"phpstan/phpstan-strict-rules": "^1.4",
32-
"phpunit/phpunit": "^9.5.26",
32+
"phpunit/phpunit": "^10.1",
3333
"predis/predis": "^1.1 || ^2",
3434
"ruflin/elastica": "^7",
3535
"symfony/mailer": "^5.4 || ^6",

phpunit.xml.dist

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="tests/bootstrap.php"
5+
colors="true"
6+
beStrictAboutTestsThatDoNotTestAnything="false">
7+
<testsuites>
8+
<testsuite name="Monolog Test Suite">
9+
<directory>tests/Monolog/</directory>
10+
</testsuite>
11+
</testsuites>
212

3-
<phpunit
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
6-
bootstrap="tests/bootstrap.php" colors="true"
7-
beStrictAboutTestsThatDoNotTestAnything="false"
8-
>
9-
<testsuites>
10-
<testsuite name="Monolog Test Suite">
11-
<directory>tests/Monolog/</directory>
12-
</testsuite>
13-
</testsuites>
13+
<coverage/>
1414

15-
<coverage>
16-
<include>
17-
<directory suffix=".php">src/Monolog/</directory>
18-
</include>
19-
</coverage>
15+
<php>
16+
<ini name="date.timezone" value="UTC"/>
17+
</php>
18+
19+
<source>
20+
<include>
21+
<directory suffix=".php">src/Monolog/</directory>
22+
</include>
23+
</source>
2024

21-
<php>
22-
<ini name="date.timezone" value="UTC"/>
23-
</php>
2425
</phpunit>

tests/Monolog/ErrorHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testHandleError()
5151
}
5252
}
5353

54-
public function fatalHandlerProvider()
54+
public static function fatalHandlerProvider()
5555
{
5656
return [
5757
[null, 10, str_repeat(' ', 1024 * 10), LogLevel::ALERT],

tests/Monolog/Formatter/JsonFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class TestJsonNormPrivate
327327

328328
class TestJsonNormWithToStringAndJson implements JsonSerializable
329329
{
330-
public function jsonSerialize()
330+
public function jsonSerialize(): mixed
331331
{
332332
return ['json serialized'];
333333
}

tests/Monolog/Formatter/LineFormatterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ public function testDefFormatWithExceptionAndStacktraceParserFull()
160160

161161
$trace = explode('[stacktrace]', $message, 2)[1];
162162

163-
$this->assertStringContainsString('TestCase.php', $trace);
164-
$this->assertStringContainsString('TestResult.php', $trace);
163+
$this->assertStringContainsString('TestSuite.php', $trace);
164+
$this->assertStringContainsString('TestRunner.php', $trace);
165165
}
166166

167167
public function testDefFormatWithExceptionAndStacktraceParserCustom()
168168
{
169169
$formatter = new LineFormatter(null, 'Y-m-d');
170170
$formatter->includeStacktraces(true, function ($line) {
171-
if (strpos($line, 'TestCase.php') === false) {
171+
if (strpos($line, 'TestSuite.php') === false) {
172172
return $line;
173173
}
174174
});
@@ -177,8 +177,8 @@ public function testDefFormatWithExceptionAndStacktraceParserCustom()
177177

178178
$trace = explode('[stacktrace]', $message, 2)[1];
179179

180-
$this->assertStringNotContainsString('TestCase.php', $trace);
181-
$this->assertStringContainsString('TestResult.php', $trace);
180+
$this->assertStringNotContainsString('TestSuite.php', $trace);
181+
$this->assertStringContainsString('TestRunner.php', $trace);
182182
}
183183

184184
public function testDefFormatWithExceptionAndStacktraceParserEmpty()

tests/Monolog/Formatter/MongoDBFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function setUp(): void
2929
}
3030
}
3131

32-
public function constructArgumentProvider()
32+
public static function constructArgumentProvider()
3333
{
3434
return [
3535
[1, true, 1, true],

tests/Monolog/Formatter/SyslogFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testFormat(
6464
/**
6565
* @return mixed[]
6666
*/
67-
public function formatDataProvider(): array
67+
public static function formatDataProvider(): array
6868
{
6969
return [
7070
'error' => [

tests/Monolog/Handler/ElasticaHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function testConnectionErrors($ignore, $expectedError)
146146
}
147147
}
148148

149-
public function providerTestConnectionErrors(): array
149+
public static function providerTestConnectionErrors(): array
150150
{
151151
return [
152152
[false, ['RuntimeException', 'Error sending messages to Elasticsearch']],

0 commit comments

Comments
 (0)