Skip to content

Commit

Permalink
chore: Upgrade to phpunit10
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel committed Feb 17, 2024
1 parent 3c3e836 commit bd39ea0
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"ext-pcntl": "*",
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.3.4 || ^1.4.2",
"phpunit/phpunit": "^8.5.19 || ^9.4"
"phpunit/phpunit": "^8.5.19 || ^10.0"
},
"autoload": {
"psr-4": {
Expand Down
60 changes: 31 additions & 29 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
bootstrap="tests/bootstrap.php"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<testsuites>
<testsuite name="Unit">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">./src/Commands</directory>
<directory suffix=".php">./src/Config</directory>
</exclude>
</whitelist>
</filter>
<php>
<env name="REDIS_HOST" value="127.0.0.1"/>
<env name="REDIS_PORT" value="6379"/>
<env name="REDIS_TIMEOUT" value="0.5"/>
<env name="REDIS_DATABASE" value="15"/>
</php>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
bootstrap="tests/bootstrap.php"
colors="true"
processIsolation="false"
stopOnFailure="true"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Unit">
<directory>./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="REDIS_HOST" value="127.0.0.1"/>
<env name="REDIS_PORT" value="6379"/>
<env name="REDIS_TIMEOUT" value="0.5"/>
<env name="REDIS_DATABASE" value="15"/>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">./src/Commands</directory>
<directory suffix=".php">./src/Config</directory>
</exclude>
</source>
</phpunit>
8 changes: 4 additions & 4 deletions tests/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function it_throws_404_for_invalid_file(): void
public function it_throws_exception_for_file_with_no_permission(): void
{
$this->expectException(FileException::class);
$this->expectErrorMessageMatches('/Unable to open [a-zA-Z0-9-\/.]+/');
$this->expectExceptionMessageMatches('/Unable to open [a-zA-Z0-9-\/.]+/');

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

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

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

$this->assertFileNotExists($path);
$this->assertFileDoesNotExist($path);
}

/**
Expand Down Expand Up @@ -460,7 +460,7 @@ public function it_deletes_files_only(): string
$this->file->delete($files);

foreach ($files as $file) {
$this->assertFileNotExists($file);
$this->assertFileDoesNotExist($file);
}

$this->assertFileExists($path);
Expand Down Expand Up @@ -496,7 +496,7 @@ public function it_deletes_empty_folder(string $path)
{
$this->file->delete(["$path/1"], true);

$this->assertFileNotExists($path);
$this->assertFileDoesNotExist($path);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function it_sends_binary_response(): void
$response = $this->response->createOnly(true)->download($file, $name);

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

$this->assertEquals(200, $response->getStatusCode());
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'/inline; filename=(empty.txt|"empty.txt")/',
$response->headers->get('content-disposition')
);
Expand Down
2 changes: 1 addition & 1 deletion tests/Tus/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ public function it_creates_a_partial_resource_with_post_request(): void
$this->assertEquals('http://tus-server/files/' . $key, $this->tusClientMock->create($key));
}

public function createWithUploadDataProvider()
public static function createWithUploadDataProvider()
{
return [
[-1],
Expand Down
2 changes: 1 addition & 1 deletion tests/Tus/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@ public function it_handles_download_request(): void
$response = $this->tusServerMock->handleGet();

$this->assertEquals(200, $response->getStatusCode());
$this->assertRegExp(
$this->assertMatchesRegularExpression(
"/attachment; filename=($fileName|\"$fileName\")/",
$response->headers->get('content-disposition')
);
Expand Down

0 comments on commit bd39ea0

Please sign in to comment.