Fixes tests

This commit is contained in:
Nuno Maduro
2025-04-20 22:19:25 +01:00
parent 8cfb0acf46
commit 791734a29c
8 changed files with 73 additions and 66 deletions

View File

@ -76,11 +76,11 @@
"test:lint": "pint --test", "test:lint": "pint --test",
"test:type:check": "phpstan analyse --ansi --memory-limit=-1 --debug", "test:type:check": "phpstan analyse --ansi --memory-limit=-1 --debug",
"test:type:coverage": "php -d memory_limit=-1 bin/pest --type-coverage --min=100", "test:type:coverage": "php -d memory_limit=-1 bin/pest --type-coverage --min=100",
"test:unit": "php bin/pest --colors=always --exclude-group=integration --compact", "test:unit": "php bin/pest --exclude-group=integration --compact",
"test:inline": "php bin/pest --colors=always --configuration=phpunit.inline.xml", "test:inline": "php bin/pest --configuration=phpunit.inline.xml",
"test:parallel": "php bin/pest --colors=always --exclude-group=integration --parallel --processes=3", "test:parallel": "php bin/pest --exclude-group=integration --parallel --processes=3",
"test:integration": "php bin/pest --colors=always --group=integration -v", "test:integration": "php bin/pest --group=integration -v",
"update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always --update-snapshots", "update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --update-snapshots",
"test": [ "test": [
"@test:refacto", "@test:refacto",
"@test:lint", "@test:lint",

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string function version(): string
{ {
return '3.8.2'; return '4.0.0-alpha.1';
} }
function testDirectory(string $file = ''): string function testDirectory(string $file = ''): string

View File

@ -313,6 +313,7 @@ final class WrapperRunner implements RunnerInterface
$testResult = unserialize($contents); $testResult = unserialize($contents);
assert($testResult instanceof TestResult); assert($testResult instanceof TestResult);
$testResultSum = new TestResult( $testResultSum = new TestResult(
(int) $testResultSum->hasTests() + (int) $testResult->hasTests(), (int) $testResultSum->hasTests() + (int) $testResult->hasTests(),
$testResultSum->numberOfTestsRun() + $testResult->numberOfTestsRun(), $testResultSum->numberOfTestsRun() + $testResult->numberOfTestsRun(),
@ -325,8 +326,10 @@ final class WrapperRunner implements RunnerInterface
array_merge_recursive($testResultSum->testMarkedIncompleteEvents(), $testResult->testMarkedIncompleteEvents()), array_merge_recursive($testResultSum->testMarkedIncompleteEvents(), $testResult->testMarkedIncompleteEvents()),
array_merge_recursive($testResultSum->testTriggeredPhpunitDeprecationEvents(), $testResult->testTriggeredPhpunitDeprecationEvents()), array_merge_recursive($testResultSum->testTriggeredPhpunitDeprecationEvents(), $testResult->testTriggeredPhpunitDeprecationEvents()),
array_merge_recursive($testResultSum->testTriggeredPhpunitErrorEvents(), $testResult->testTriggeredPhpunitErrorEvents()), array_merge_recursive($testResultSum->testTriggeredPhpunitErrorEvents(), $testResult->testTriggeredPhpunitErrorEvents()),
array_merge_recursive($testResultSum->testTriggeredPhpunitNoticeEvents(), $testResult->testTriggeredPhpunitNoticeEvents()),
array_merge_recursive($testResultSum->testTriggeredPhpunitWarningEvents(), $testResult->testTriggeredPhpunitWarningEvents()), array_merge_recursive($testResultSum->testTriggeredPhpunitWarningEvents(), $testResult->testTriggeredPhpunitWarningEvents()),
array_merge_recursive($testResultSum->testRunnerTriggeredDeprecationEvents(), $testResult->testRunnerTriggeredDeprecationEvents()), array_merge_recursive($testResultSum->testRunnerTriggeredDeprecationEvents(), $testResult->testRunnerTriggeredDeprecationEvents()),
array_merge_recursive($testResultSum->testRunnerTriggeredNoticeEvents(), $testResult->testRunnerTriggeredNoticeEvents()),
array_merge_recursive($testResultSum->testRunnerTriggeredWarningEvents(), $testResult->testRunnerTriggeredWarningEvents()), array_merge_recursive($testResultSum->testRunnerTriggeredWarningEvents(), $testResult->testRunnerTriggeredWarningEvents()),
array_merge_recursive($testResultSum->errors(), $testResult->errors()), array_merge_recursive($testResultSum->errors(), $testResult->errors()),
array_merge_recursive($testResultSum->deprecations(), $testResult->deprecations()), array_merge_recursive($testResultSum->deprecations(), $testResult->deprecations()),
@ -351,8 +354,10 @@ final class WrapperRunner implements RunnerInterface
$testResultSum->testMarkedIncompleteEvents(), $testResultSum->testMarkedIncompleteEvents(),
$testResultSum->testTriggeredPhpunitDeprecationEvents(), $testResultSum->testTriggeredPhpunitDeprecationEvents(),
$testResultSum->testTriggeredPhpunitErrorEvents(), $testResultSum->testTriggeredPhpunitErrorEvents(),
$testResultSum->testTriggeredPhpunitNoticeEvents(),
$testResultSum->testTriggeredPhpunitWarningEvents(), $testResultSum->testTriggeredPhpunitWarningEvents(),
$testResultSum->testRunnerTriggeredDeprecationEvents(), $testResultSum->testRunnerTriggeredDeprecationEvents(),
$testResultSum->testRunnerTriggeredNoticeEvents(),
array_values(array_filter( array_values(array_filter(
$testResultSum->testRunnerTriggeredWarningEvents(), $testResultSum->testRunnerTriggeredWarningEvents(),
fn (WarningTriggered $event): bool => ! str_contains($event->message(), 'No tests found') fn (WarningTriggered $event): bool => ! str_contains($event->message(), 'No tests found')

View File

@ -131,14 +131,14 @@ final class CompactPrinter
$status['collected'], $status['collected'],
$status['threshold'], $status['threshold'],
$status['roots'], $status['roots'],
null, 0.00,
null, 0.00,
null, 0.00,
null, 0.00,
null, false,
null, false,
null, false,
null, 0,
); );
$telemetry = new Info( $telemetry = new Info(

View File

@ -1,5 +1,5 @@
Pest Testing Framework 3.8.2. Pest Testing Framework 4.0.0-alpha.1.
USAGE: pest <file> [options] USAGE: pest <file> [options]
@ -68,6 +68,7 @@
--fail-on-risky Signal failure using shell exit code when a test was considered risky --fail-on-risky Signal failure using shell exit code when a test was considered risky
--fail-on-deprecation Signal failure using shell exit code when a deprecation was triggered --fail-on-deprecation Signal failure using shell exit code when a deprecation was triggered
--fail-on-phpunit-deprecation Signal failure using shell exit code when a PHPUnit deprecation was triggered --fail-on-phpunit-deprecation Signal failure using shell exit code when a PHPUnit deprecation was triggered
--fail-on-phpunit-notice Signal failure using shell exit code when a PHPUnit notice was triggered
--fail-on-notice Signal failure using shell exit code when a notice was triggered --fail-on-notice Signal failure using shell exit code when a notice was triggered
--fail-on-skipped Signal failure using shell exit code when a test was skipped --fail-on-skipped Signal failure using shell exit code when a test was skipped
--fail-on-incomplete Signal failure using shell exit code when a test was marked incomplete --fail-on-incomplete Signal failure using shell exit code when a test was marked incomplete
@ -88,6 +89,7 @@
--display-skipped ........................ Display details for skipped tests --display-skipped ........................ Display details for skipped tests
--display-deprecations . Display details for deprecations triggered by tests --display-deprecations . Display details for deprecations triggered by tests
--display-phpunit-deprecations .... Display details for PHPUnit deprecations --display-phpunit-deprecations .... Display details for PHPUnit deprecations
--display-phpunit-notices .............. Display details for PHPUnit notices
--display-errors ............. Display details for errors triggered by tests --display-errors ............. Display details for errors triggered by tests
--display-notices ........... Display details for notices triggered by tests --display-notices ........... Display details for notices triggered by tests
--display-warnings ......... Display details for warnings triggered by tests --display-warnings ......... Display details for warnings triggered by tests

View File

@ -1,3 +1,3 @@
Pest Testing Framework 3.8.2. Pest Testing Framework 4.0.0-alpha.1.

View File

@ -2,57 +2,57 @@
use Pest\Expectation; use Pest\Expectation;
// arch()->preset()->php()->ignoring([ arch()->preset()->php()->ignoring([
// Expectation::class, Expectation::class,
// 'debug_backtrace', 'debug_backtrace',
// 'var_export', 'var_export',
// 'xdebug_info', 'xdebug_info',
// ]); ]);
// arch()->preset()->strict()->ignoring([ arch()->preset()->strict()->ignoring([
// 'usleep', 'usleep',
// ]); ]);
// arch()->preset()->security()->ignoring([ arch()->preset()->security()->ignoring([
// 'eval', 'eval',
// 'str_shuffle', 'str_shuffle',
// 'exec', 'exec',
// 'unserialize', 'unserialize',
// 'extract', 'extract',
// 'assert', 'assert',
// ]); ]);
// arch('globals') arch('globals')
// ->expect(['dd', 'dump', 'ray', 'die', 'var_dump', 'sleep']) ->expect(['dd', 'dump', 'ray', 'die', 'var_dump', 'sleep'])
// ->not->toBeUsed() ->not->toBeUsed()
// ->ignoring(Expectation::class); ->ignoring(Expectation::class);
// arch('dependencies') arch('dependencies')
// ->expect('Pest') ->expect('Pest')
// ->toOnlyUse([ ->toOnlyUse([
// 'dd', 'dd',
// 'dump', 'dump',
// 'expect', 'expect',
// 'uses', 'uses',
// 'Termwind', 'Termwind',
// 'ParaTest', 'ParaTest',
// 'Pest\Arch', 'Pest\Arch',
// 'Pest\Mutate\Contracts\Configuration', 'Pest\Mutate\Contracts\Configuration',
// 'Pest\Mutate\Decorators\TestCallDecorator', 'Pest\Mutate\Decorators\TestCallDecorator',
// 'Pest\Mutate\Repositories\ConfigurationRepository', 'Pest\Mutate\Repositories\ConfigurationRepository',
// 'Pest\Plugin', 'Pest\Plugin',
// 'NunoMaduro\Collision', 'NunoMaduro\Collision',
// 'Whoops', 'Whoops',
// 'Symfony\Component\Console', 'Symfony\Component\Console',
// 'Symfony\Component\Process', 'Symfony\Component\Process',
// ])->ignoring(['Composer', 'PHPUnit', 'SebastianBergmann']); ])->ignoring(['Composer', 'PHPUnit', 'SebastianBergmann']);
// arch('contracts') arch('contracts')
// ->expect('Pest\Contracts') ->expect('Pest\Contracts')
// ->toOnlyUse([ ->toOnlyUse([
// 'NunoMaduro\Collision\Contracts', 'NunoMaduro\Collision\Contracts',
// 'Pest\Factories\TestCaseMethodFactory', 'Pest\Factories\TestCaseMethodFactory',
// 'Symfony\Component\Console', 'Symfony\Component\Console',
// 'Pest\Arch\Contracts', 'Pest\Arch\Contracts',
// 'Pest\PendingCalls', 'Pest\PendingCalls',
// ])->toBeInterfaces(); ])->toBeInterfaces();

View File

@ -10,4 +10,4 @@ test('preset invalid name', function () {
$this->preset()->myAnotherFramework(); $this->preset()->myAnotherFramework();
})->throws(InvalidArgumentException::class, 'The preset [myAnotherFramework] does not exist. The available presets are [php, laravel, strict, security, relaxed, myFramework].'); })->throws(InvalidArgumentException::class, 'The preset [myAnotherFramework] does not exist. The available presets are [php, laravel, strict, security, relaxed, myFramework].');
// arch()->preset()->myFramework(); arch()->preset()->myFramework();