mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
Fixes filtering tests
This commit is contained in:
@ -45,6 +45,7 @@ declare(strict_types=1);
|
|||||||
namespace PHPUnit\TextUI;
|
namespace PHPUnit\TextUI;
|
||||||
|
|
||||||
use Pest\Plugins\Only;
|
use Pest\Plugins\Only;
|
||||||
|
use Pest\Runner\Filter\EnsureTestCaseIsInitiatedFilter;
|
||||||
use PHPUnit\Event;
|
use PHPUnit\Event;
|
||||||
use PHPUnit\Framework\TestSuite;
|
use PHPUnit\Framework\TestSuite;
|
||||||
use PHPUnit\Runner\Filter\Factory;
|
use PHPUnit\Runner\Filter\Factory;
|
||||||
@ -66,6 +67,12 @@ final readonly class TestSuiteFilterProcessor
|
|||||||
{
|
{
|
||||||
$factory = new Factory;
|
$factory = new Factory;
|
||||||
|
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
|
(fn () => $this->filters[] = [
|
||||||
|
'className' => EnsureTestCaseIsInitiatedFilter::class,
|
||||||
|
'argument' => '',
|
||||||
|
])->call($factory);
|
||||||
|
|
||||||
if (! $configuration->hasFilter() &&
|
if (! $configuration->hasFilter() &&
|
||||||
! $configuration->hasGroups() &&
|
! $configuration->hasGroups() &&
|
||||||
! $configuration->hasExcludeGroups() &&
|
! $configuration->hasExcludeGroups() &&
|
||||||
@ -73,6 +80,8 @@ final readonly class TestSuiteFilterProcessor
|
|||||||
! $configuration->hasTestsCovering() &&
|
! $configuration->hasTestsCovering() &&
|
||||||
! $configuration->hasTestsUsing() &&
|
! $configuration->hasTestsUsing() &&
|
||||||
! Only::isEnabled()) {
|
! Only::isEnabled()) {
|
||||||
|
$suite->injectFilter($factory);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ final class BootExcludeList implements Bootstrapper
|
|||||||
*
|
*
|
||||||
* @var array<int, non-empty-string>
|
* @var array<int, non-empty-string>
|
||||||
*/
|
*/
|
||||||
private const EXCLUDE_LIST = [
|
private const array EXCLUDE_LIST = [
|
||||||
'bin',
|
'bin',
|
||||||
'overrides',
|
'overrides',
|
||||||
'resources',
|
'resources',
|
||||||
|
|||||||
@ -24,7 +24,7 @@ final class BootFiles implements Bootstrapper
|
|||||||
*
|
*
|
||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
private const STRUCTURE = [
|
private const array STRUCTURE = [
|
||||||
'Expectations',
|
'Expectations',
|
||||||
'Expectations.php',
|
'Expectations.php',
|
||||||
'Helpers',
|
'Helpers',
|
||||||
|
|||||||
@ -17,7 +17,7 @@ final class BootOverrides implements Bootstrapper
|
|||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
public const FILES = [
|
public const array FILES = [
|
||||||
'53c246e5f416a39817ac81124cdd64ea8403038d01d7a202e1ffa486fbdf3fa7' => 'Runner/Filter/NameFilterIterator.php',
|
'53c246e5f416a39817ac81124cdd64ea8403038d01d7a202e1ffa486fbdf3fa7' => 'Runner/Filter/NameFilterIterator.php',
|
||||||
'77ffb7647b583bd82e37962c6fbdc4b04d3344d8a2c1ed103e625ed1ff7cb5c2' => 'Runner/ResultCache/DefaultResultCache.php',
|
'77ffb7647b583bd82e37962c6fbdc4b04d3344d8a2c1ed103e625ed1ff7cb5c2' => 'Runner/ResultCache/DefaultResultCache.php',
|
||||||
'd0e81317889ad88c707db4b08a94cadee4c9010d05ff0a759f04e71af5efed89' => 'Runner/TestSuiteLoader.php',
|
'd0e81317889ad88c707db4b08a94cadee4c9010d05ff0a759f04e71af5efed89' => 'Runner/TestSuiteLoader.php',
|
||||||
|
|||||||
@ -20,7 +20,7 @@ final readonly class BootSubscribers implements Bootstrapper
|
|||||||
*
|
*
|
||||||
* @var array<int, class-string<Subscriber>>
|
* @var array<int, class-string<Subscriber>>
|
||||||
*/
|
*/
|
||||||
private const SUBSCRIBERS = [
|
private const array SUBSCRIBERS = [
|
||||||
Subscribers\EnsureConfigurationIsAvailable::class,
|
Subscribers\EnsureConfigurationIsAvailable::class,
|
||||||
Subscribers\EnsureIgnorableTestCasesAreIgnored::class,
|
Subscribers\EnsureIgnorableTestCasesAreIgnored::class,
|
||||||
Subscribers\EnsureKernelDumpIsFlushed::class,
|
Subscribers\EnsureKernelDumpIsFlushed::class,
|
||||||
|
|||||||
@ -219,9 +219,6 @@ trait Testable
|
|||||||
{
|
{
|
||||||
TestSuite::getInstance()->test = $this;
|
TestSuite::getInstance()->test = $this;
|
||||||
|
|
||||||
// Initialize test case properties
|
|
||||||
$this->__initializeTestCase();
|
|
||||||
|
|
||||||
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
|
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
|
||||||
|
|
||||||
$method->setUp($this);
|
$method->setUp($this);
|
||||||
@ -270,7 +267,7 @@ trait Testable
|
|||||||
/**
|
/**
|
||||||
* Initialize test case properties from TestSuite.
|
* Initialize test case properties from TestSuite.
|
||||||
*/
|
*/
|
||||||
private function __initializeTestCase(): void
|
public function __initializeTestCase(): void
|
||||||
{
|
{
|
||||||
// Return if the test case has already been initialized
|
// Return if the test case has already been initialized
|
||||||
if (isset($this->__test)) {
|
if (isset($this->__test)) {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ final readonly class Help
|
|||||||
*
|
*
|
||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
private const HELP_MESSAGES = [
|
private const array HELP_MESSAGES = [
|
||||||
'<comment>Pest Options:</comment>',
|
'<comment>Pest Options:</comment>',
|
||||||
' <info>--init</info> Initialise a standard Pest configuration',
|
' <info>--init</info> Initialise a standard Pest configuration',
|
||||||
' <info>--coverage</info> Enable coverage and output to standard output',
|
' <info>--coverage</info> Enable coverage and output to standard output',
|
||||||
|
|||||||
@ -22,7 +22,7 @@ final readonly class Thanks
|
|||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
private const FUNDING_MESSAGES = [
|
private const array FUNDING_MESSAGES = [
|
||||||
'Star' => 'https://github.com/pestphp/pest',
|
'Star' => 'https://github.com/pestphp/pest',
|
||||||
'YouTube' => 'https://youtube.com/@nunomaduro',
|
'YouTube' => 'https://youtube.com/@nunomaduro',
|
||||||
'TikTok' => 'https://tiktok.com/@nunomaduro',
|
'TikTok' => 'https://tiktok.com/@nunomaduro',
|
||||||
|
|||||||
@ -34,7 +34,7 @@ final readonly class Kernel
|
|||||||
*
|
*
|
||||||
* @var array<int, class-string>
|
* @var array<int, class-string>
|
||||||
*/
|
*/
|
||||||
private const BOOTSTRAPPERS = [
|
private const array BOOTSTRAPPERS = [
|
||||||
Bootstrappers\BootOverrides::class,
|
Bootstrappers\BootOverrides::class,
|
||||||
Bootstrappers\BootSubscribers::class,
|
Bootstrappers\BootSubscribers::class,
|
||||||
Bootstrappers\BootFiles::class,
|
Bootstrappers\BootFiles::class,
|
||||||
|
|||||||
@ -31,7 +31,7 @@ final readonly class Converter
|
|||||||
/**
|
/**
|
||||||
* The prefix for the test suite name.
|
* The prefix for the test suite name.
|
||||||
*/
|
*/
|
||||||
private const PREFIX = 'P\\';
|
private const string PREFIX = 'P\\';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The state generator.
|
* The state generator.
|
||||||
|
|||||||
@ -21,7 +21,7 @@ final class Cache implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* The temporary folder.
|
* The temporary folder.
|
||||||
*/
|
*/
|
||||||
private const TEMPORARY_FOLDER = __DIR__
|
private const string TEMPORARY_FOLDER = __DIR__
|
||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
.'..'
|
.'..'
|
||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
|
|||||||
@ -21,7 +21,7 @@ final class Configuration implements HandlesArguments, Terminable
|
|||||||
/**
|
/**
|
||||||
* The base PHPUnit file.
|
* The base PHPUnit file.
|
||||||
*/
|
*/
|
||||||
public const BASE_PHPUNIT_FILE = __DIR__
|
public const string BASE_PHPUNIT_FILE = __DIR__
|
||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
.'..'
|
.'..'
|
||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
|
|||||||
@ -17,20 +17,11 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
*/
|
*/
|
||||||
final class Coverage implements AddsOutput, HandlesArguments
|
final class Coverage implements AddsOutput, HandlesArguments
|
||||||
{
|
{
|
||||||
/**
|
private const string COVERAGE_OPTION = 'coverage';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private const COVERAGE_OPTION = 'coverage';
|
|
||||||
|
|
||||||
/**
|
private const string MIN_OPTION = 'min';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private const MIN_OPTION = 'min';
|
|
||||||
|
|
||||||
/**
|
private const string EXACTLY_OPTION = 'exactly';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private const EXACTLY_OPTION = 'exactly';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether it should show the coverage or not.
|
* Whether it should show the coverage or not.
|
||||||
|
|||||||
@ -14,12 +14,12 @@ final class Environment implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* The continuous integration environment.
|
* The continuous integration environment.
|
||||||
*/
|
*/
|
||||||
public const CI = 'ci';
|
public const string CI = 'ci';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The local environment.
|
* The local environment.
|
||||||
*/
|
*/
|
||||||
public const LOCAL = 'local';
|
public const string LOCAL = 'local';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current environment.
|
* The current environment.
|
||||||
|
|||||||
@ -20,12 +20,12 @@ final readonly class Init implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* The option the triggers the init job.
|
* The option the triggers the init job.
|
||||||
*/
|
*/
|
||||||
private const INIT_OPTION = '--init';
|
private const string INIT_OPTION = '--init';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The files that will be created.
|
* The files that will be created.
|
||||||
*/
|
*/
|
||||||
private const STUBS = [
|
private const array STUBS = [
|
||||||
'phpunit.xml.stub' => 'phpunit.xml',
|
'phpunit.xml.stub' => 'phpunit.xml',
|
||||||
'Pest.php.stub' => 'tests/Pest.php',
|
'Pest.php.stub' => 'tests/Pest.php',
|
||||||
'TestCase.php.stub' => 'tests/TestCase.php',
|
'TestCase.php.stub' => 'tests/TestCase.php',
|
||||||
|
|||||||
@ -15,7 +15,7 @@ final class Only implements Terminable
|
|||||||
/**
|
/**
|
||||||
* The temporary folder.
|
* The temporary folder.
|
||||||
*/
|
*/
|
||||||
private const TEMPORARY_FOLDER = __DIR__
|
private const string TEMPORARY_FOLDER = __DIR__
|
||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
.'..'
|
.'..'
|
||||||
.DIRECTORY_SEPARATOR
|
.DIRECTORY_SEPARATOR
|
||||||
|
|||||||
@ -23,9 +23,9 @@ final class Parallel implements HandlesArguments
|
|||||||
{
|
{
|
||||||
use HandleArguments;
|
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\Parallel::class,
|
||||||
Parallel\Handlers\Pest::class,
|
Parallel\Handlers\Pest::class,
|
||||||
Parallel\Handlers\Laravel::class,
|
Parallel\Handlers\Laravel::class,
|
||||||
@ -34,7 +34,7 @@ final class Parallel implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* @var string[]
|
* @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.
|
* Whether the given command line arguments indicate that the test suite should be run in parallel.
|
||||||
|
|||||||
@ -18,7 +18,7 @@ final class Parallel implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* The list of arguments to remove.
|
* The list of arguments to remove.
|
||||||
*/
|
*/
|
||||||
private const ARGS_TO_REMOVE = [
|
private const array ARGS_TO_REMOVE = [
|
||||||
'--parallel',
|
'--parallel',
|
||||||
'-p',
|
'-p',
|
||||||
'--no-output',
|
'--no-output',
|
||||||
|
|||||||
@ -11,6 +11,7 @@ final class CleanConsoleOutput extends ConsoleOutput
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
#[\Override]
|
||||||
protected function doWrite(string $message, bool $newline): void // @pest-arch-ignore-line
|
protected function doWrite(string $message, bool $newline): void // @pest-arch-ignore-line
|
||||||
{
|
{
|
||||||
if ($this->isOpeningHeadline($message)) {
|
if ($this->isOpeningHeadline($message)) {
|
||||||
|
|||||||
@ -50,7 +50,7 @@ final class WrapperRunner implements RunnerInterface
|
|||||||
/**
|
/**
|
||||||
* The time to sleep between cycles.
|
* The time to sleep between cycles.
|
||||||
*/
|
*/
|
||||||
private const CYCLE_SLEEP = 10000;
|
private const int CYCLE_SLEEP = 10000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The result printer.
|
* The result printer.
|
||||||
@ -313,7 +313,6 @@ 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(),
|
||||||
@ -328,15 +327,25 @@ final class WrapperRunner implements RunnerInterface
|
|||||||
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->testTriggeredPhpunitNoticeEvents(), $testResult->testTriggeredPhpunitNoticeEvents()),
|
||||||
array_merge_recursive($testResultSum->testTriggeredPhpunitWarningEvents(), $testResult->testTriggeredPhpunitWarningEvents()),
|
array_merge_recursive($testResultSum->testTriggeredPhpunitWarningEvents(), $testResult->testTriggeredPhpunitWarningEvents()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->testRunnerTriggeredDeprecationEvents(), $testResult->testRunnerTriggeredDeprecationEvents()),
|
array_merge_recursive($testResultSum->testRunnerTriggeredDeprecationEvents(), $testResult->testRunnerTriggeredDeprecationEvents()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->testRunnerTriggeredNoticeEvents(), $testResult->testRunnerTriggeredNoticeEvents()),
|
array_merge_recursive($testResultSum->testRunnerTriggeredNoticeEvents(), $testResult->testRunnerTriggeredNoticeEvents()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->testRunnerTriggeredWarningEvents(), $testResult->testRunnerTriggeredWarningEvents()),
|
array_merge_recursive($testResultSum->testRunnerTriggeredWarningEvents(), $testResult->testRunnerTriggeredWarningEvents()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->errors(), $testResult->errors()),
|
array_merge_recursive($testResultSum->errors(), $testResult->errors()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->deprecations(), $testResult->deprecations()),
|
array_merge_recursive($testResultSum->deprecations(), $testResult->deprecations()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->notices(), $testResult->notices()),
|
array_merge_recursive($testResultSum->notices(), $testResult->notices()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->warnings(), $testResult->warnings()),
|
array_merge_recursive($testResultSum->warnings(), $testResult->warnings()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->phpDeprecations(), $testResult->phpDeprecations()),
|
array_merge_recursive($testResultSum->phpDeprecations(), $testResult->phpDeprecations()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->phpNotices(), $testResult->phpNotices()),
|
array_merge_recursive($testResultSum->phpNotices(), $testResult->phpNotices()),
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
array_merge_recursive($testResultSum->phpWarnings(), $testResult->phpWarnings()),
|
array_merge_recursive($testResultSum->phpWarnings(), $testResult->phpWarnings()),
|
||||||
$testResultSum->numberOfIssuesIgnoredByBaseline() + $testResult->numberOfIssuesIgnoredByBaseline(),
|
$testResultSum->numberOfIssuesIgnoredByBaseline() + $testResult->numberOfIssuesIgnoredByBaseline(),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ final class CompactPrinter
|
|||||||
/**
|
/**
|
||||||
* @var array<string, array<int, string>>
|
* @var array<string, array<int, string>>
|
||||||
*/
|
*/
|
||||||
private const LOOKUP_TABLE = [
|
private const array LOOKUP_TABLE = [
|
||||||
'.' => ['gray', '.'],
|
'.' => ['gray', '.'],
|
||||||
'S' => ['yellow', 's'],
|
'S' => ['yellow', 's'],
|
||||||
'T' => ['cyan', 't'],
|
'T' => ['cyan', 't'],
|
||||||
|
|||||||
@ -16,7 +16,7 @@ final class Verbose implements HandlesArguments
|
|||||||
/**
|
/**
|
||||||
* The list of verbosity levels.
|
* The list of verbosity levels.
|
||||||
*/
|
*/
|
||||||
private const VERBOSITY_LEVELS = ['v', 'vv', 'vvv', 'q'];
|
private const array VERBOSITY_LEVELS = ['v', 'vv', 'vvv', 'q'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ use function sprintf;
|
|||||||
*/
|
*/
|
||||||
final class DatasetsRepository
|
final class DatasetsRepository
|
||||||
{
|
{
|
||||||
private const SEPARATOR = '>>';
|
private const string SEPARATOR = '>>';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the datasets.
|
* Holds the datasets.
|
||||||
|
|||||||
@ -13,11 +13,11 @@ use PHPUnit\TextUI\Configuration\Configuration;
|
|||||||
*/
|
*/
|
||||||
final class Result
|
final class Result
|
||||||
{
|
{
|
||||||
private const SUCCESS_EXIT = 0;
|
private const int SUCCESS_EXIT = 0;
|
||||||
|
|
||||||
private const FAILURE_EXIT = 1;
|
private const int FAILURE_EXIT = 1;
|
||||||
|
|
||||||
private const EXCEPTION_EXIT = 2;
|
private const int EXCEPTION_EXIT = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the exit code is different from 0.
|
* If the exit code is different from 0.
|
||||||
|
|||||||
39
src/Runner/Filter/EnsureTestCaseIsInitiatedFilter.php
Normal file
39
src/Runner/Filter/EnsureTestCaseIsInitiatedFilter.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Pest\Runner\Filter;
|
||||||
|
|
||||||
|
use Pest\Contracts\HasPrintableTestCaseName;
|
||||||
|
use PHPUnit\Framework\Test;
|
||||||
|
use RecursiveFilterIterator;
|
||||||
|
use RecursiveIterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class EnsureTestCaseIsInitiatedFilter extends RecursiveFilterIterator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param RecursiveIterator<int, Test> $iterator
|
||||||
|
*/
|
||||||
|
public function __construct(RecursiveIterator $iterator)
|
||||||
|
{
|
||||||
|
parent::__construct($iterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function accept(): bool
|
||||||
|
{
|
||||||
|
$test = $this->getInnerIterator()->current();
|
||||||
|
|
||||||
|
if ($test instanceof HasPrintableTestCaseName) {
|
||||||
|
/** @phpstan-ignore-next-line */
|
||||||
|
$test->__initializeTestCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,12 +11,9 @@ use Pest\Exceptions\ShouldNotHappen;
|
|||||||
*/
|
*/
|
||||||
final class Backtrace
|
final class Backtrace
|
||||||
{
|
{
|
||||||
/**
|
private const string FILE = 'file';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private const FILE = 'file';
|
|
||||||
|
|
||||||
private const BACKTRACE_OPTIONS = DEBUG_BACKTRACE_IGNORE_ARGS;
|
private const int BACKTRACE_OPTIONS = DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current test file.
|
* Returns the current test file.
|
||||||
|
|||||||
@ -11,9 +11,9 @@ use function Pest\testDirectory;
|
|||||||
*/
|
*/
|
||||||
final class DatasetInfo
|
final class DatasetInfo
|
||||||
{
|
{
|
||||||
public const DATASETS_DIR_NAME = 'Datasets';
|
public const string DATASETS_DIR_NAME = 'Datasets';
|
||||||
|
|
||||||
public const DATASETS_FILE_NAME = 'Datasets.php';
|
public const string DATASETS_FILE_NAME = 'Datasets.php';
|
||||||
|
|
||||||
public static function isInsideADatasetsDirectory(string $file): bool
|
public static function isInsideADatasetsDirectory(string $file): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use Throwable;
|
|||||||
*/
|
*/
|
||||||
final class ExceptionTrace
|
final class ExceptionTrace
|
||||||
{
|
{
|
||||||
private const UNDEFINED_METHOD = 'Call to undefined method P\\';
|
private const string UNDEFINED_METHOD = 'Call to undefined method P\\';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures the given closure reports the good execution context.
|
* Ensures the given closure reports the good execution context.
|
||||||
|
|||||||
@ -15,7 +15,7 @@ final readonly class Exporter
|
|||||||
/**
|
/**
|
||||||
* The maximum number of items in an array to export.
|
* The maximum number of items in an array to export.
|
||||||
*/
|
*/
|
||||||
private const MAX_ARRAY_ITEMS = 3;
|
private const int MAX_ARRAY_ITEMS = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Exporter instance.
|
* Creates a new Exporter instance.
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use Throwable;
|
|||||||
*/
|
*/
|
||||||
final class HigherOrderMessage
|
final class HigherOrderMessage
|
||||||
{
|
{
|
||||||
public const UNDEFINED_METHOD = 'Method %s does not exist';
|
public const string UNDEFINED_METHOD = 'Method %s does not exist';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An optional condition that will determine if the message will be executed.
|
* An optional condition that will determine if the message will be executed.
|
||||||
|
|||||||
@ -13,12 +13,9 @@ final class Str
|
|||||||
* Pool of alpha-numeric characters for generating (unsafe) random strings
|
* Pool of alpha-numeric characters for generating (unsafe) random strings
|
||||||
* from.
|
* from.
|
||||||
*/
|
*/
|
||||||
private const POOL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
private const string POOL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
|
||||||
/**
|
private const string PREFIX = '__pest_evaluable_';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private const PREFIX = '__pest_evaluable_';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a (unsecure & non-cryptographically safe) random alpha-numeric
|
* Create a (unsecure & non-cryptographically safe) random alpha-numeric
|
||||||
|
|||||||
Reference in New Issue
Block a user