Skip to content

Commit 653fe37

Browse files
authored
chore: Upgrade to PHPUnit 10 (#437)
1 parent 3c3e836 commit 653fe37

7 files changed

Lines changed: 48 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']
32+
php-version: ['8.0', '8.1', '8.2', '8.3']
3333
composer-flags: ["--prefer-lowest --prefer-stable", ""]
3434
fail-fast: false
3535
services:
@@ -65,8 +65,10 @@ jobs:
6565
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover=coverage.clover
6666

6767
- name: Upload coverage report to codecov
68-
if: matrix.php-version == '7.3'
69-
run: |
70-
wget https://scrutinizer-ci.com/ocular.phar
71-
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
72-
bash <(curl -s https://codecov.io/bash)
68+
uses: codecov/codecov-action@v4
69+
with:
70+
fail_ci_if_error: true
71+
files: coverage.clover
72+
token: ${{ secrets.CODECOV_TOKEN }}
73+
verbose: true
74+
if: matrix.php-version == '8.3'

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"ext-pcntl": "*",
2626
"friendsofphp/php-cs-fixer": "^3.0",
2727
"mockery/mockery": "^1.3.4 || ^1.4.2",
28-
"phpunit/phpunit": "^8.5.19 || ^9.4"
28+
"phpunit/phpunit": "^8.5.19 || ^10.0"
2929
},
3030
"autoload": {
3131
"psr-4": {

phpunit.xml

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
bootstrap="tests/bootstrap.php"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="true">
11-
<testsuites>
12-
<testsuite name="Unit">
13-
<directory>./tests</directory>
14-
</testsuite>
15-
</testsuites>
16-
<filter>
17-
<whitelist processUncoveredFilesFromWhitelist="true">
18-
<directory suffix=".php">src/</directory>
19-
<exclude>
20-
<directory suffix=".php">./src/Commands</directory>
21-
<directory suffix=".php">./src/Config</directory>
22-
</exclude>
23-
</whitelist>
24-
</filter>
25-
<php>
26-
<env name="REDIS_HOST" value="127.0.0.1"/>
27-
<env name="REDIS_PORT" value="6379"/>
28-
<env name="REDIS_TIMEOUT" value="0.5"/>
29-
<env name="REDIS_DATABASE" value="15"/>
30-
</php>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
5+
backupGlobals="false"
6+
bootstrap="tests/bootstrap.php"
7+
colors="true"
8+
processIsolation="false"
9+
stopOnFailure="true"
10+
cacheDirectory=".phpunit.cache"
11+
backupStaticProperties="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Unit">
15+
<directory>./tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<php>
19+
<env name="REDIS_HOST" value="127.0.0.1"/>
20+
<env name="REDIS_PORT" value="6379"/>
21+
<env name="REDIS_TIMEOUT" value="0.5"/>
22+
<env name="REDIS_DATABASE" value="15"/>
23+
</php>
24+
<source>
25+
<include>
26+
<directory suffix=".php">src/</directory>
27+
</include>
28+
<exclude>
29+
<directory suffix=".php">./src/Commands</directory>
30+
<directory suffix=".php">./src/Config</directory>
31+
</exclude>
32+
</source>
3133
</phpunit>

tests/FileTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function it_throws_404_for_invalid_file(): void
205205
public function it_throws_exception_for_file_with_no_permission(): void
206206
{
207207
$this->expectException(FileException::class);
208-
$this->expectErrorMessageMatches('/Unable to open [a-zA-Z0-9-\/.]+/');
208+
$this->expectExceptionMessageMatches('/Unable to open [a-zA-Z0-9-\/.]+/');
209209

210210
$file = __DIR__ . '/Fixtures/403.txt';
211211

@@ -413,7 +413,7 @@ public function it_deletes_all_files_and_folder(string $path): void
413413

414414
$this->file->delete($files, true);
415415

416-
$this->assertFileNotExists($path);
416+
$this->assertFileDoesNotExist($path);
417417
}
418418

419419
/**
@@ -460,7 +460,7 @@ public function it_deletes_files_only(): string
460460
$this->file->delete($files);
461461

462462
foreach ($files as $file) {
463-
$this->assertFileNotExists($file);
463+
$this->assertFileDoesNotExist($file);
464464
}
465465

466466
$this->assertFileExists($path);
@@ -496,7 +496,7 @@ public function it_deletes_empty_folder(string $path)
496496
{
497497
$this->file->delete(["$path/1"], true);
498498

499-
$this->assertFileNotExists($path);
499+
$this->assertFileDoesNotExist($path);
500500
}
501501

502502
/**

tests/ResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function it_sends_binary_response(): void
144144
$response = $this->response->createOnly(true)->download($file, $name);
145145

146146
$this->assertEquals(200, $response->getStatusCode());
147-
$this->assertRegExp(
147+
$this->assertMatchesRegularExpression(
148148
"/attachment; filename=($name|\"$name\")/",
149149
$response->headers->get('content-disposition')
150150
);
@@ -162,7 +162,7 @@ public function it_sends_binary_response_when_name_is_null(): void
162162
$response = $this->response->createOnly(true)->download($file, null, [], 'inline');
163163

164164
$this->assertEquals(200, $response->getStatusCode());
165-
$this->assertRegExp(
165+
$this->assertMatchesRegularExpression(
166166
'/inline; filename=(empty.txt|"empty.txt")/',
167167
$response->headers->get('content-disposition')
168168
);

tests/Tus/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,7 @@ public function it_creates_a_partial_resource_with_post_request(): void
13401340
$this->assertEquals('http://tus-server/files/' . $key, $this->tusClientMock->create($key));
13411341
}
13421342

1343-
public function createWithUploadDataProvider()
1343+
public static function createWithUploadDataProvider()
13441344
{
13451345
return [
13461346
[-1],

tests/Tus/ServerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2622,7 +2622,7 @@ public function it_handles_download_request(): void
26222622
$response = $this->tusServerMock->handleGet();
26232623

26242624
$this->assertEquals(200, $response->getStatusCode());
2625-
$this->assertRegExp(
2625+
$this->assertMatchesRegularExpression(
26262626
"/attachment; filename=($fileName|\"$fileName\")/",
26272627
$response->headers->get('content-disposition')
26282628
);

0 commit comments

Comments
 (0)