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:type:check": "phpstan analyse --ansi --memory-limit=-1 --debug",
"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:inline": "php bin/pest --colors=always --configuration=phpunit.inline.xml",
"test:parallel": "php bin/pest --colors=always --exclude-group=integration --parallel --processes=3",
"test:integration": "php bin/pest --colors=always --group=integration -v",
"update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always --update-snapshots",
"test:unit": "php bin/pest --exclude-group=integration --compact",
"test:inline": "php bin/pest --configuration=phpunit.inline.xml",
"test:parallel": "php bin/pest --exclude-group=integration --parallel --processes=3",
"test:integration": "php bin/pest --group=integration -v",
"update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --update-snapshots",
"test": [
"@test:refacto",
"@test:lint",

View File

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

View File

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

View File

@ -131,14 +131,14 @@ final class CompactPrinter
$status['collected'],
$status['threshold'],
$status['roots'],
null,
null,
null,
null,
null,
null,
null,
null,
0.00,
0.00,
0.00,
0.00,
false,
false,
false,
0,
);
$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]
@ -68,6 +68,7 @@
--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-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-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
@ -88,6 +89,7 @@
--display-skipped ........................ Display details for skipped tests
--display-deprecations . Display details for deprecations triggered by tests
--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-notices ........... Display details for notices 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;
// arch()->preset()->php()->ignoring([
// Expectation::class,
// 'debug_backtrace',
// 'var_export',
// 'xdebug_info',
// ]);
arch()->preset()->php()->ignoring([
Expectation::class,
'debug_backtrace',
'var_export',
'xdebug_info',
]);
// arch()->preset()->strict()->ignoring([
// 'usleep',
// ]);
arch()->preset()->strict()->ignoring([
'usleep',
]);
// arch()->preset()->security()->ignoring([
// 'eval',
// 'str_shuffle',
// 'exec',
// 'unserialize',
// 'extract',
// 'assert',
// ]);
arch()->preset()->security()->ignoring([
'eval',
'str_shuffle',
'exec',
'unserialize',
'extract',
'assert',
]);
// arch('globals')
// ->expect(['dd', 'dump', 'ray', 'die', 'var_dump', 'sleep'])
// ->not->toBeUsed()
// ->ignoring(Expectation::class);
arch('globals')
->expect(['dd', 'dump', 'ray', 'die', 'var_dump', 'sleep'])
->not->toBeUsed()
->ignoring(Expectation::class);
// arch('dependencies')
// ->expect('Pest')
// ->toOnlyUse([
// 'dd',
// 'dump',
// 'expect',
// 'uses',
// 'Termwind',
// 'ParaTest',
// 'Pest\Arch',
// 'Pest\Mutate\Contracts\Configuration',
// 'Pest\Mutate\Decorators\TestCallDecorator',
// 'Pest\Mutate\Repositories\ConfigurationRepository',
// 'Pest\Plugin',
// 'NunoMaduro\Collision',
// 'Whoops',
// 'Symfony\Component\Console',
// 'Symfony\Component\Process',
// ])->ignoring(['Composer', 'PHPUnit', 'SebastianBergmann']);
arch('dependencies')
->expect('Pest')
->toOnlyUse([
'dd',
'dump',
'expect',
'uses',
'Termwind',
'ParaTest',
'Pest\Arch',
'Pest\Mutate\Contracts\Configuration',
'Pest\Mutate\Decorators\TestCallDecorator',
'Pest\Mutate\Repositories\ConfigurationRepository',
'Pest\Plugin',
'NunoMaduro\Collision',
'Whoops',
'Symfony\Component\Console',
'Symfony\Component\Process',
])->ignoring(['Composer', 'PHPUnit', 'SebastianBergmann']);
// arch('contracts')
// ->expect('Pest\Contracts')
// ->toOnlyUse([
// 'NunoMaduro\Collision\Contracts',
// 'Pest\Factories\TestCaseMethodFactory',
// 'Symfony\Component\Console',
// 'Pest\Arch\Contracts',
// 'Pest\PendingCalls',
// ])->toBeInterfaces();
arch('contracts')
->expect('Pest\Contracts')
->toOnlyUse([
'NunoMaduro\Collision\Contracts',
'Pest\Factories\TestCaseMethodFactory',
'Symfony\Component\Console',
'Pest\Arch\Contracts',
'Pest\PendingCalls',
])->toBeInterfaces();

View File

@ -10,4 +10,4 @@ test('preset invalid name', function () {
$this->preset()->myAnotherFramework();
})->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();