feat: php 8.4 support

This commit is contained in:
Nuno Maduro
2024-10-15 15:31:29 +01:00
parent 9ceb0834ae
commit e8aaa586cb
11 changed files with 14 additions and 106 deletions

View File

@ -14,7 +14,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
symfony: ['6.4', '7.0'] symfony: ['6.4', '7.0']
php: ['8.1', '8.2', '8.3'] php: ['8.1', '8.2', '8.3', '8.4']
dependency_version: [prefer-lowest, prefer-stable] dependency_version: [prefer-lowest, prefer-stable]
exclude: exclude:
- php: '8.1' - php: '8.1'

View File

@ -20,13 +20,14 @@
"php": "^8.1.0", "php": "^8.1.0",
"brianium/paratest": "^7.3.1", "brianium/paratest": "^7.3.1",
"nunomaduro/collision": "^7.10.0|^8.4.0", "nunomaduro/collision": "^7.10.0|^8.4.0",
"nunomaduro/termwind": "^1.15.1|^2.0.1", "nunomaduro/termwind": "^1.15.1|^2.1.0",
"pestphp/pest-plugin": "^2.1.1", "pestphp/pest-plugin": "^2.1.1",
"pestphp/pest-plugin-arch": "^2.7.0", "pestphp/pest-plugin-arch": "^2.7.0",
"phpunit/phpunit": "^10.5.17" "phpunit/phpunit": "^10.5.36"
}, },
"conflict": { "conflict": {
"phpunit/phpunit": ">10.5.17", "filp/whoops": "<2.16.0",
"phpunit/phpunit": ">10.5.36",
"sebastian/exporter": "<5.1.0", "sebastian/exporter": "<5.1.0",
"webmozart/assert": "<1.11.0" "webmozart/assert": "<1.11.0"
}, },
@ -51,9 +52,9 @@
] ]
}, },
"require-dev": { "require-dev": {
"pestphp/pest-dev-tools": "^2.16.0", "pestphp/pest-dev-tools": "^2.17.0",
"pestphp/pest-plugin-type-coverage": "^2.8.5", "pestphp/pest-plugin-type-coverage": "^2.8.7",
"symfony/process": "^6.4.0|^7.1.3" "symfony/process": "^6.4.0|^7.1.5"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,

View File

@ -1,6 +1,5 @@
includes: includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon - vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/ergebnis/phpstan-rules/rules.neon
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
parameters: parameters:
@ -12,12 +11,4 @@ parameters:
reportUnmatchedIgnoredErrors: true reportUnmatchedIgnoredErrors: true
ignoreErrors: ignoreErrors:
- "#has a nullable return type declaration.#"
- "#Language construct isset\\(\\) should not be used.#"
- "#is not allowed to extend#"
- "#is concrete, but does not have a Test suffix#"
- "#with a nullable type declaration#"
- "#type mixed is not subtype of native#" - "#type mixed is not subtype of native#"
- "# with null as default value#"
- "#has parameter \\$closure with default value.#"
- "#has parameter \\$description with default value.#"

View File

@ -20,7 +20,7 @@ abstract class Attribute
* @param array<int, string> $attributes * @param array<int, string> $attributes
* @return array<int, string> * @return array<int, string>
*/ */
public function __invoke(TestCaseMethodFactory $method, array $attributes): array // @phpstan-ignore-line public function __invoke(TestCaseMethodFactory $method, array $attributes): array
{ {
return $attributes; return $attributes;
} }

View File

@ -194,7 +194,7 @@ final class TestCaseFactory
} }
PHP; PHP;
eval($classCode); // @phpstan-ignore-line eval($classCode);
} catch (ParseError $caught) { } catch (ParseError $caught) {
throw new RuntimeException(sprintf( throw new RuntimeException(sprintf(
"Unable to create test case for test file at %s. \n %s", "Unable to create test case for test file at %s. \n %s",

View File

@ -40,7 +40,7 @@ final class KernelDump
*/ */
public function disable(): void public function disable(): void
{ {
@ob_clean(); // @phpstan-ignore-line @ob_clean();
if ($this->buffer !== '') { if ($this->buffer !== '') {
$this->flush(); $this->flush();

View File

@ -391,7 +391,7 @@ final class WrapperRunner implements RunnerInterface
$testSuite = (new LogMerger)->merge($this->junitFiles); $testSuite = (new LogMerger)->merge($this->junitFiles);
(new Writer)->write( (new Writer)->write(
$testSuite, $testSuite, // @phpstan-ignore-line
$this->options->configuration->logfileJunit(), $this->options->configuration->logfileJunit(),
); );
} }

View File

@ -1173,16 +1173,6 @@
PASS Tests\Hooks\BeforeEachTest PASS Tests\Hooks\BeforeEachTest
✓ global beforeEach execution order ✓ global beforeEach execution order
PASS Tests\Overrides\VersionsTest
✓ versions with dataset "Runner/Filter/NameFilterIterator.php"
✓ versions with dataset "Runner/ResultCache/DefaultResultCache.php"
✓ versions with dataset "Runner/TestSuiteLoader.php"
✓ versions with dataset "TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php"
✓ versions with dataset "TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php"
✓ versions with dataset "TextUI/TestSuiteFilterProcessor.php"
✓ versions with dataset "Event/Value/ThrowableBuilder.php"
✓ versions with dataset "Logging/JUnit/JunitXmlLogger.php"
PASS Tests\PHPUnit\CustomAffixes\InvalidTestName PASS Tests\PHPUnit\CustomAffixes\InvalidTestName
✓ it runs file names like @#$%^&()-_=+.php ✓ it runs file names like @#$%^&()-_=+.php
@ -1287,26 +1277,6 @@
✓ it can resolve builtin value types ✓ it can resolve builtin value types
✓ it cannot resolve a parameter without type ✓ it cannot resolve a parameter without type
PASS Tests\Unit\Support\DatasetInfo
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Datase…rs.php', true)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Datasets.php', false)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Featur…rs.php', true)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Featur…rs.php', false)
✓ it can check if dataset is defined inside a Datasets directory with ('/var/www/project/tests/Featur…ts.php', false)
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Datase…rs.php', false)
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Datasets.php', true)
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Featur…rs.php', false) #1
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Featur…rs.php', false) #2
✓ it can check if dataset is defined inside a Datasets.php file with ('/var/www/project/tests/Featur…ts.php', true)
✓ it computes the dataset scope with ('/var/www/project/tests/Datase…rs.php', '/var/www/project/tests')
✓ it computes the dataset scope with ('/var/www/project/tests/Datasets.php', '/var/www/project/tests')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur…rs.php', '/var/www/project/tests/Features')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur…rs.php', '/var/www/project/tests/Featur…rs.php') #1
✓ it computes the dataset scope with ('/var/www/project/tests/Featur…ts.php', '/var/www/project/tests/Features')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur…rs.php', '/var/www/project/tests/Featur…ollers')
✓ it computes the dataset scope with ('/var/www/project/tests/Featur…rs.php', '/var/www/project/tests/Featur…rs.php') #2
✓ it computes the dataset scope with ('/var/www/project/tests/Featur…ts.php', '/var/www/project/tests/Featur…ollers')
PASS Tests\Unit\Support\ExceptionTrace PASS Tests\Unit\Support\ExceptionTrace
✓ it ensures the given closures reports the correct class name ✓ it ensures the given closures reports the correct class name
✓ it ensures the given closures reports the correct class name and suggests the [uses()] function ✓ it ensures the given closures reports the correct class name and suggests the [uses()] function
@ -1425,4 +1395,4 @@
WARN Tests\Visual\Version WARN Tests\Visual\Version
- visual snapshot of help command output - visual snapshot of help command output
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 1014 passed (2407 assertions) Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 988 passed (2381 assertions)

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
use Pest\Bootstrappers\BootOverrides;
test('versions', function (string $vendorPath, string $expectedHash) {
expect(hash_file('sha256', $vendorPath))->toBe($expectedHash);
})->with(function () {
foreach (BootOverrides::FILES as $hash => $file) {
$path = implode(DIRECTORY_SEPARATOR, [
dirname(__DIR__, 2),
'vendor/phpunit/phpunit/src',
$file,
]);
yield $file => [$path, $hash];
}
});

View File

@ -1,36 +0,0 @@
<?php
use Pest\Support\DatasetInfo;
it('can check if dataset is defined inside a Datasets directory', function (string $file, bool $inside) {
expect(DatasetInfo::isInsideADatasetsDirectory($file))->toBe($inside);
})->with([
['file' => '/var/www/project/tests/Datasets/Numbers.php', 'inside' => true],
['file' => '/var/www/project/tests/Datasets.php', 'inside' => false],
['file' => '/var/www/project/tests/Features/Datasets/Numbers.php', 'inside' => true],
['file' => '/var/www/project/tests/Features/Numbers.php', 'inside' => false],
['file' => '/var/www/project/tests/Features/Datasets.php', 'inside' => false],
]);
it('can check if dataset is defined inside a Datasets.php file', function (string $path, bool $inside) {
expect(DatasetInfo::isADatasetsFile($path))->toBe($inside);
})->with([
['file' => '/var/www/project/tests/Datasets/Numbers.php', 'inside' => false],
['file' => '/var/www/project/tests/Datasets.php', 'inside' => true],
['file' => '/var/www/project/tests/Features/Datasets/Numbers.php', 'inside' => false],
['file' => '/var/www/project/tests/Features/Numbers.php', 'inside' => false],
['file' => '/var/www/project/tests/Features/Datasets.php', 'inside' => true],
]);
it('computes the dataset scope', function (string $file, string $scope) {
expect(DatasetInfo::scope($file))->toBe($scope);
})->with([
['file' => '/var/www/project/tests/Datasets/Numbers.php', 'scope' => '/var/www/project/tests'],
['file' => '/var/www/project/tests/Datasets.php', 'scope' => '/var/www/project/tests'],
['file' => '/var/www/project/tests/Features/Datasets/Numbers.php', 'scope' => '/var/www/project/tests/Features'],
['file' => '/var/www/project/tests/Features/Numbers.php', 'scope' => '/var/www/project/tests/Features/Numbers.php'],
['file' => '/var/www/project/tests/Features/Datasets.php', 'scope' => '/var/www/project/tests/Features'],
['file' => '/var/www/project/tests/Features/Controllers/Datasets/Numbers.php', 'scope' => '/var/www/project/tests/Features/Controllers'],
['file' => '/var/www/project/tests/Features/Controllers/Numbers.php', 'scope' => '/var/www/project/tests/Features/Controllers/Numbers.php'],
['file' => '/var/www/project/tests/Features/Controllers/Datasets.php', 'scope' => '/var/www/project/tests/Features/Controllers'],
]);

View File

@ -16,7 +16,7 @@ $run = function () {
test('parallel', function () use ($run) { test('parallel', function () use ($run) {
expect($run('--exclude-group=integration')) expect($run('--exclude-group=integration'))
->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 999 passed (2360 assertions)') ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 973 passed (2334 assertions)')
->toContain('Parallel: 3 processes'); ->toContain('Parallel: 3 processes');
})->skipOnWindows(); })->skipOnWindows();