Skip to content

Commit

Permalink
Upgrade phpunit to version ^10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Jan 6, 2024
1 parent 73e9afd commit b13a3b7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/
raw-tests/
vendor/
.php-cs-fixer.cache
.phpunit.cache
.phpunit.result.cache
composer.lock
composer.phar
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"jetbrains/phpstorm-attributes": "^1.0",
"phpmd/phpmd": "^2.13",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^10.5"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
18 changes: 10 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false"
bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false"
stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
bootstrap="vendor/autoload.php" colors="true" stopOnError="false" stopOnFailure="false"
stopOnIncomplete="false" stopOnSkipped="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.cache">
<coverage>
<report>
<clover outputFile="build/coverage/clover.xml"/>
<html outputDirectory="build/coverage"/>
Expand All @@ -28,4 +25,9 @@
<env name="REDIS_HOST" value="redis"/>
<env name="XDEBUG_MODE" value="coverage"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
12 changes: 6 additions & 6 deletions tests/LanguagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
*/
final class LanguagesTest extends TestCase
{
protected string $langDir = __DIR__ . '/../src/Languages/';
protected static string $langDir = __DIR__ . '/../src/Languages/';

/**
* @return array<int,string>
*/
protected function getCodes() : array
{
// @phpstan-ignore-next-line
$codes = \array_filter((array) \glob($this->langDir . '*'), 'is_dir');
$length = \strlen($this->langDir);
$codes = \array_filter((array) \glob(self::$langDir . '*'), 'is_dir');
$length = \strlen(self::$langDir);
$result = [];
foreach ($codes as &$dir) {
if ($dir === false) {
Expand All @@ -47,7 +47,7 @@ protected function getCodes() : array
public function testKeys(array $rules, string $file) : void
{
foreach ($this->getCodes() as $code) {
$lines = require $this->langDir . $code . '/' . $file . '.php';
$lines = require self::$langDir . $code . '/' . $file . '.php';
$lines = \array_keys($lines);
\sort($lines);
self::assertSame($rules, $lines, 'File: ' . $file . '. Language: ' . $code);
Expand All @@ -57,15 +57,15 @@ public function testKeys(array $rules, string $file) : void
/**
* @return array<string,array<mixed>>
*/
public function languageProvider() : array
public static function languageProvider() : array
{
$files = [
'validation',
];
$data = [];
foreach ($files as $file) {
$data[$file] = [
\array_keys(require $this->langDir . 'en/' . $file . '.php'),
\array_keys(require self::$langDir . 'en/' . $file . '.php'),
$file,
];
}
Expand Down

0 comments on commit b13a3b7

Please sign in to comment.