Fixes filtering tests

This commit is contained in:
Nuno Maduro
2025-04-29 11:38:33 +01:00
parent db9243ca2e
commit a310796165
31 changed files with 98 additions and 58 deletions

View File

@ -21,7 +21,7 @@ final class Cache implements HandlesArguments
/**
* The temporary folder.
*/
private const TEMPORARY_FOLDER = __DIR__
private const string TEMPORARY_FOLDER = __DIR__
.DIRECTORY_SEPARATOR
.'..'
.DIRECTORY_SEPARATOR

View File

@ -21,7 +21,7 @@ final class Configuration implements HandlesArguments, Terminable
/**
* The base PHPUnit file.
*/
public const BASE_PHPUNIT_FILE = __DIR__
public const string BASE_PHPUNIT_FILE = __DIR__
.DIRECTORY_SEPARATOR
.'..'
.DIRECTORY_SEPARATOR

View File

@ -17,20 +17,11 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
final class Coverage implements AddsOutput, HandlesArguments
{
/**
* @var string
*/
private const COVERAGE_OPTION = 'coverage';
private const string COVERAGE_OPTION = 'coverage';
/**
* @var string
*/
private const MIN_OPTION = 'min';
private const string MIN_OPTION = 'min';
/**
* @var string
*/
private const EXACTLY_OPTION = 'exactly';
private const string EXACTLY_OPTION = 'exactly';
/**
* Whether it should show the coverage or not.

View File

@ -14,12 +14,12 @@ final class Environment implements HandlesArguments
/**
* The continuous integration environment.
*/
public const CI = 'ci';
public const string CI = 'ci';
/**
* The local environment.
*/
public const LOCAL = 'local';
public const string LOCAL = 'local';
/**
* The current environment.

View File

@ -20,12 +20,12 @@ final readonly class Init implements HandlesArguments
/**
* The option the triggers the init job.
*/
private const INIT_OPTION = '--init';
private const string INIT_OPTION = '--init';
/**
* The files that will be created.
*/
private const STUBS = [
private const array STUBS = [
'phpunit.xml.stub' => 'phpunit.xml',
'Pest.php.stub' => 'tests/Pest.php',
'TestCase.php.stub' => 'tests/TestCase.php',

View File

@ -15,7 +15,7 @@ final class Only implements Terminable
/**
* The temporary folder.
*/
private const TEMPORARY_FOLDER = __DIR__
private const string TEMPORARY_FOLDER = __DIR__
.DIRECTORY_SEPARATOR
.'..'
.DIRECTORY_SEPARATOR

View File

@ -23,9 +23,9 @@ final class Parallel implements HandlesArguments
{
use HandleArguments;
private const GLOBAL_PREFIX = 'PEST_PARALLEL_GLOBAL_';
private const string GLOBAL_PREFIX = 'PEST_PARALLEL_GLOBAL_';
private const HANDLERS = [
private const array HANDLERS = [
Parallel\Handlers\Parallel::class,
Parallel\Handlers\Pest::class,
Parallel\Handlers\Laravel::class,
@ -34,7 +34,7 @@ final class Parallel implements HandlesArguments
/**
* @var string[]
*/
private const UNSUPPORTED_ARGUMENTS = ['--todo', '--todos', '--retry', '--notes', '--issue', '--pr', '--pull-request'];
private const array UNSUPPORTED_ARGUMENTS = ['--todo', '--todos', '--retry', '--notes', '--issue', '--pr', '--pull-request'];
/**
* Whether the given command line arguments indicate that the test suite should be run in parallel.

View File

@ -18,7 +18,7 @@ final class Parallel implements HandlesArguments
/**
* The list of arguments to remove.
*/
private const ARGS_TO_REMOVE = [
private const array ARGS_TO_REMOVE = [
'--parallel',
'-p',
'--no-output',

View File

@ -11,6 +11,7 @@ final class CleanConsoleOutput extends ConsoleOutput
/**
* {@inheritdoc}
*/
#[\Override]
protected function doWrite(string $message, bool $newline): void // @pest-arch-ignore-line
{
if ($this->isOpeningHeadline($message)) {

View File

@ -50,7 +50,7 @@ final class WrapperRunner implements RunnerInterface
/**
* The time to sleep between cycles.
*/
private const CYCLE_SLEEP = 10000;
private const int CYCLE_SLEEP = 10000;
/**
* The result printer.
@ -313,7 +313,6 @@ 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(),
@ -328,15 +327,25 @@ final class WrapperRunner implements RunnerInterface
array_merge_recursive($testResultSum->testTriggeredPhpunitErrorEvents(), $testResult->testTriggeredPhpunitErrorEvents()),
array_merge_recursive($testResultSum->testTriggeredPhpunitNoticeEvents(), $testResult->testTriggeredPhpunitNoticeEvents()),
array_merge_recursive($testResultSum->testTriggeredPhpunitWarningEvents(), $testResult->testTriggeredPhpunitWarningEvents()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->testRunnerTriggeredDeprecationEvents(), $testResult->testRunnerTriggeredDeprecationEvents()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->testRunnerTriggeredNoticeEvents(), $testResult->testRunnerTriggeredNoticeEvents()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->testRunnerTriggeredWarningEvents(), $testResult->testRunnerTriggeredWarningEvents()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->errors(), $testResult->errors()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->deprecations(), $testResult->deprecations()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->notices(), $testResult->notices()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->warnings(), $testResult->warnings()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->phpDeprecations(), $testResult->phpDeprecations()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->phpNotices(), $testResult->phpNotices()),
// @phpstan-ignore-next-line
array_merge_recursive($testResultSum->phpWarnings(), $testResult->phpWarnings()),
$testResultSum->numberOfIssuesIgnoredByBaseline() + $testResult->numberOfIssuesIgnoredByBaseline(),
);

View File

@ -34,7 +34,7 @@ final class CompactPrinter
/**
* @var array<string, array<int, string>>
*/
private const LOOKUP_TABLE = [
private const array LOOKUP_TABLE = [
'.' => ['gray', '.'],
'S' => ['yellow', 's'],
'T' => ['cyan', 't'],

View File

@ -16,7 +16,7 @@ final class Verbose implements HandlesArguments
/**
* The list of verbosity levels.
*/
private const VERBOSITY_LEVELS = ['v', 'vv', 'vvv', 'q'];
private const array VERBOSITY_LEVELS = ['v', 'vv', 'vvv', 'q'];
/**
* {@inheritDoc}