diff --git a/src/Runner/TestResult/Collector.php b/src/Runner/TestResult/Collector.php index fe7e22993c..9d5c61602f 100644 --- a/src/Runner/TestResult/Collector.php +++ b/src/Runner/TestResult/Collector.php @@ -626,51 +626,43 @@ public function childProcessErrored(ChildProcessErrored $event): void $this->childProcessErrored = true; } - public function hasErroredTests(): bool + public function numberOfErroredTests(): int { - return $this->testErroredEvents !== []; + return count($this->testErroredEvents); } - public function hasFailedTests(): bool + public function numberOfFailedTests(): int { - return $this->testFailedEvents !== []; + return count($this->testFailedEvents); } - public function hasRiskyTests(): bool + public function numberOfRiskyTests(): int { - return $this->testConsideredRiskyEvents !== []; + return count($this->testConsideredRiskyEvents); } - public function hasSkippedTests(): bool + public function numberOfSkippedTests(): int { - return $this->testSkippedEvents !== []; + return count($this->testSkippedEvents); } - public function hasIncompleteTests(): bool + public function numberOfIncompleteTests(): int { - return $this->testMarkedIncompleteEvents !== []; + return count($this->testMarkedIncompleteEvents); } - public function hasDeprecations(): bool + public function numberOfNotices(): int { - return $this->deprecations !== [] || - $this->phpDeprecations !== [] || - $this->testTriggeredPhpunitDeprecationEvents !== [] || - $this->testRunnerTriggeredDeprecationEvents !== []; + return count($this->notices) + + count($this->phpNotices); } - public function hasNotices(): bool + public function numberOfWarnings(): int { - return $this->notices !== [] || - $this->phpNotices !== []; - } - - public function hasWarnings(): bool - { - return $this->warnings !== [] || - $this->phpWarnings !== [] || - $this->testTriggeredPhpunitWarningEvents !== [] || - $this->testRunnerTriggeredWarningEvents !== []; + return count($this->warnings) + + count($this->phpWarnings) + + count($this->testTriggeredPhpunitWarningEvents) + + count($this->testRunnerTriggeredWarningEvents); } /** diff --git a/src/Runner/TestResult/Facade.php b/src/Runner/TestResult/Facade.php index c95ff53b0f..d911dce2fa 100644 --- a/src/Runner/TestResult/Facade.php +++ b/src/Runner/TestResult/Facade.php @@ -9,7 +9,8 @@ */ namespace PHPUnit\TestRunner\TestResult; -use function array_any; +use function array_filter; +use function count; use function str_contains; use PHPUnit\Event\Facade as EventFacade; use PHPUnit\Runner\DeprecationCollector\Facade as DeprecationCollectorFacade; @@ -41,19 +42,38 @@ public static function shouldStop(): bool $configuration = ConfigurationRegistry::get(); $collector = self::collector(); - if (($configuration->stopOnDefect() || $configuration->stopOnError()) && $collector->hasErroredTests()) { + $numberOfErrors = $collector->numberOfErroredTests(); + $numberOfFailures = $collector->numberOfFailedTests(); + $numberOfWarnings = $collector->numberOfWarnings(); + $numberOfRisky = $collector->numberOfRiskyTests(); + + $stopOnDefect = $configuration->stopOnDefectThreshold(); + + if ($stopOnDefect > 0 && ($numberOfErrors + $numberOfFailures + $numberOfWarnings + $numberOfRisky) >= $stopOnDefect) { return true; } - if (($configuration->stopOnDefect() || $configuration->stopOnFailure()) && $collector->hasFailedTests()) { + $stopOnError = $configuration->stopOnErrorThreshold(); + + if ($stopOnError > 0 && $numberOfErrors >= $stopOnError) { + return true; + } + + $stopOnFailure = $configuration->stopOnFailureThreshold(); + + if ($stopOnFailure > 0 && $numberOfFailures >= $stopOnFailure) { return true; } - if (($configuration->stopOnDefect() || $configuration->stopOnWarning()) && $collector->hasWarnings()) { + $stopOnWarning = $configuration->stopOnWarningThreshold(); + + if ($stopOnWarning > 0 && $numberOfWarnings >= $stopOnWarning) { return true; } - if (($configuration->stopOnDefect() || $configuration->stopOnRisky()) && $collector->hasRiskyTests()) { + $stopOnRisky = $configuration->stopOnRiskyThreshold(); + + if ($stopOnRisky > 0 && $numberOfRisky >= $stopOnRisky) { return true; } @@ -61,15 +81,21 @@ public static function shouldStop(): bool return true; } - if ($configuration->stopOnNotice() && $collector->hasNotices()) { + $stopOnNotice = $configuration->stopOnNoticeThreshold(); + + if ($stopOnNotice > 0 && $collector->numberOfNotices() >= $stopOnNotice) { return true; } - if ($configuration->stopOnIncomplete() && $collector->hasIncompleteTests()) { + $stopOnIncomplete = $configuration->stopOnIncompleteThreshold(); + + if ($stopOnIncomplete > 0 && $collector->numberOfIncompleteTests() >= $stopOnIncomplete) { return true; } - if ($configuration->stopOnSkipped() && $collector->hasSkippedTests()) { + $stopOnSkipped = $configuration->stopOnSkippedThreshold(); + + if ($stopOnSkipped > 0 && $collector->numberOfSkippedTests() >= $stopOnSkipped) { return true; } @@ -92,22 +118,24 @@ private static function collector(): Collector private static function stopOnDeprecation(Configuration $configuration): bool { - if (!$configuration->stopOnDeprecation()) { + $threshold = $configuration->stopOnDeprecationThreshold(); + + if ($threshold === 0) { return false; } $deprecations = DeprecationCollectorFacade::filteredDeprecations(); - if (!$configuration->hasSpecificDeprecationToStopOn()) { - return $deprecations !== []; + if ($configuration->hasSpecificDeprecationToStopOn()) { + $deprecations = array_filter( + $deprecations, + static fn (string $deprecation) => str_contains( + $deprecation, + $configuration->specificDeprecationToStopOn(), + ), + ); } - return array_any( - $deprecations, - static fn (string $deprecation) => str_contains( - $deprecation, - $configuration->specificDeprecationToStopOn(), - ), - ); + return count($deprecations) >= $threshold; } } diff --git a/src/TextUI/Configuration/Cli/Builder.php b/src/TextUI/Configuration/Cli/Builder.php index 068a34e39e..89cb2f3467 100644 --- a/src/TextUI/Configuration/Cli/Builder.php +++ b/src/TextUI/Configuration/Cli/Builder.php @@ -16,6 +16,7 @@ use function getcwd; use function is_file; use function is_numeric; +use function max; use function sprintf; use function strtolower; use PHPUnit\Event\Facade as EventFacade; @@ -135,15 +136,15 @@ final class Builder 'do-not-fail-on-risky', 'do-not-fail-on-skipped', 'do-not-fail-on-warning', - 'stop-on-defect', + 'stop-on-defect==', 'stop-on-deprecation==', - 'stop-on-error', - 'stop-on-failure', - 'stop-on-incomplete', - 'stop-on-notice', - 'stop-on-risky', - 'stop-on-skipped', - 'stop-on-warning', + 'stop-on-error==', + 'stop-on-failure==', + 'stop-on-incomplete==', + 'stop-on-notice==', + 'stop-on-risky==', + 'stop-on-skipped==', + 'stop-on-warning==', 'strict-coverage', 'disable-coverage-ignore', 'strict-global-state', @@ -933,51 +934,51 @@ public function fromParameters(array $parameters): Configuration break; case '--stop-on-defect': - $stopOnDefect = true; + $stopOnDefect = $this->parseStopOnValue($option[1]); break; case '--stop-on-deprecation': - $stopOnDeprecation = true; + $stopOnDeprecation = $this->parseStopOnValue($option[1]); - if ($option[1] !== null) { + if ($option[1] !== null && !is_numeric($option[1])) { $specificDeprecationToStopOn = $option[1]; } break; case '--stop-on-error': - $stopOnError = true; + $stopOnError = $this->parseStopOnValue($option[1]); break; case '--stop-on-failure': - $stopOnFailure = true; + $stopOnFailure = $this->parseStopOnValue($option[1]); break; case '--stop-on-incomplete': - $stopOnIncomplete = true; + $stopOnIncomplete = $this->parseStopOnValue($option[1]); break; case '--stop-on-notice': - $stopOnNotice = true; + $stopOnNotice = $this->parseStopOnValue($option[1]); break; case '--stop-on-risky': - $stopOnRisky = true; + $stopOnRisky = $this->parseStopOnValue($option[1]); break; case '--stop-on-skipped': - $stopOnSkipped = true; + $stopOnSkipped = $this->parseStopOnValue($option[1]); break; case '--stop-on-warning': - $stopOnWarning = true; + $stopOnWarning = $this->parseStopOnValue($option[1]); break; @@ -1422,4 +1423,16 @@ private function warnWhenOptionsConflict(?bool $current, string $option, string ), ); } + + /** + * @return positive-int + */ + private function parseStopOnValue(?string $value): int + { + if ($value !== null && is_numeric($value)) { + return max(1, (int) $value); + } + + return 1; + } } diff --git a/src/TextUI/Configuration/Cli/Configuration.php b/src/TextUI/Configuration/Cli/Configuration.php index 42409c02cf..f3d7787e12 100644 --- a/src/TextUI/Configuration/Cli/Configuration.php +++ b/src/TextUI/Configuration/Cli/Configuration.php @@ -86,16 +86,16 @@ private ?bool $doNotFailOnRisky; private ?bool $doNotFailOnSkipped; private ?bool $doNotFailOnWarning; - private ?bool $stopOnDefect; - private ?bool $stopOnDeprecation; + private ?int $stopOnDefect; + private ?int $stopOnDeprecation; private ?string $specificDeprecationToStopOn; - private ?bool $stopOnError; - private ?bool $stopOnFailure; - private ?bool $stopOnIncomplete; - private ?bool $stopOnNotice; - private ?bool $stopOnRisky; - private ?bool $stopOnSkipped; - private ?bool $stopOnWarning; + private ?int $stopOnError; + private ?int $stopOnFailure; + private ?int $stopOnIncomplete; + private ?int $stopOnNotice; + private ?int $stopOnRisky; + private ?int $stopOnSkipped; + private ?int $stopOnWarning; private ?string $filter; private ?string $excludeFilter; private ?string $generateBaseline; @@ -197,7 +197,7 @@ * @param ?non-empty-list $coverageFilter * @param ?non-empty-list $extensions */ - public function __construct(array $arguments, ?string $testFilesFile, ?bool $all, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticProperties, ?bool $beStrictAboutChangesToGlobalState, ?string $bootstrap, ?string $cacheDirectory, ?bool $cacheResult, bool $checkPhpConfiguration, bool $checkVersion, ?string $colors, null|int|string $columns, ?string $configurationFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coverageOpenClover, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $coverageXmlIncludeSource, ?bool $pathCoverage, bool $warmCoverageCache, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?bool $failOnAllIssues, ?bool $failOnDeprecation, ?bool $failOnPhpunitDeprecation, ?bool $failOnPhpunitNotice, ?bool $failOnPhpunitWarning, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnNotice, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?bool $doNotFailOnDeprecation, ?bool $doNotFailOnPhpunitDeprecation, ?bool $doNotFailOnPhpunitNotice, ?bool $doNotFailOnPhpunitWarning, ?bool $doNotFailOnEmptyTestSuite, ?bool $doNotFailOnIncomplete, ?bool $doNotFailOnNotice, ?bool $doNotFailOnRisky, ?bool $doNotFailOnSkipped, ?bool $doNotFailOnWarning, ?bool $stopOnDefect, ?bool $stopOnDeprecation, ?string $specificDeprecationToStopOn, ?bool $stopOnError, ?bool $stopOnFailure, ?bool $stopOnIncomplete, ?bool $stopOnNotice, ?bool $stopOnRisky, ?bool $stopOnSkipped, ?bool $stopOnWarning, ?string $filter, ?string $excludeFilter, ?string $generateBaseline, ?string $useBaseline, bool $ignoreBaseline, bool $generateConfiguration, bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, ?string $otrLogfile, ?bool $includeGitInformation, bool $listGroups, bool $listSuites, bool $listTestFiles, bool $listTests, ?string $listTestsXml, ?bool $noCoverage, ?bool $noExtensions, ?bool $noOutput, ?bool $noProgress, ?bool $noResults, ?bool $noLogging, ?bool $processIsolation, ?int $randomOrderSeed, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?string $teamcityLogfile, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?array $testSuffixes, ?string $testSuite, ?string $excludeTestSuite, bool $useDefaultConfiguration, ?bool $displayDetailsOnAllIssues, ?bool $displayDetailsOnIncompleteTests, ?bool $displayDetailsOnSkippedTests, ?bool $displayDetailsOnTestsThatTriggerDeprecations, ?bool $displayDetailsOnPhpunitDeprecations, ?bool $displayDetailsOnPhpunitNotices, ?bool $displayDetailsOnTestsThatTriggerErrors, ?bool $displayDetailsOnTestsThatTriggerNotices, ?bool $displayDetailsOnTestsThatTriggerWarnings, bool $version, ?array $coverageFilter, ?string $logEventsText, ?string $logEventsVerboseText, ?bool $printerTeamCity, ?bool $testdoxPrinter, ?bool $testdoxPrinterSummary, bool $debug, bool $withTelemetry, ?array $extensions) + public function __construct(array $arguments, ?string $testFilesFile, ?bool $all, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticProperties, ?bool $beStrictAboutChangesToGlobalState, ?string $bootstrap, ?string $cacheDirectory, ?bool $cacheResult, bool $checkPhpConfiguration, bool $checkVersion, ?string $colors, null|int|string $columns, ?string $configurationFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coverageOpenClover, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $coverageXmlIncludeSource, ?bool $pathCoverage, bool $warmCoverageCache, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?bool $failOnAllIssues, ?bool $failOnDeprecation, ?bool $failOnPhpunitDeprecation, ?bool $failOnPhpunitNotice, ?bool $failOnPhpunitWarning, ?bool $failOnEmptyTestSuite, ?bool $failOnIncomplete, ?bool $failOnNotice, ?bool $failOnRisky, ?bool $failOnSkipped, ?bool $failOnWarning, ?bool $doNotFailOnDeprecation, ?bool $doNotFailOnPhpunitDeprecation, ?bool $doNotFailOnPhpunitNotice, ?bool $doNotFailOnPhpunitWarning, ?bool $doNotFailOnEmptyTestSuite, ?bool $doNotFailOnIncomplete, ?bool $doNotFailOnNotice, ?bool $doNotFailOnRisky, ?bool $doNotFailOnSkipped, ?bool $doNotFailOnWarning, ?int $stopOnDefect, ?int $stopOnDeprecation, ?string $specificDeprecationToStopOn, ?int $stopOnError, ?int $stopOnFailure, ?int $stopOnIncomplete, ?int $stopOnNotice, ?int $stopOnRisky, ?int $stopOnSkipped, ?int $stopOnWarning, ?string $filter, ?string $excludeFilter, ?string $generateBaseline, ?string $useBaseline, bool $ignoreBaseline, bool $generateConfiguration, bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, ?string $otrLogfile, ?bool $includeGitInformation, bool $listGroups, bool $listSuites, bool $listTestFiles, bool $listTests, ?string $listTestsXml, ?bool $noCoverage, ?bool $noExtensions, ?bool $noOutput, ?bool $noProgress, ?bool $noResults, ?bool $noLogging, ?bool $processIsolation, ?int $randomOrderSeed, ?bool $reportUselessTests, ?bool $resolveDependencies, ?bool $reverseList, ?bool $stderr, ?bool $strictCoverage, ?string $teamcityLogfile, ?string $testdoxHtmlFile, ?string $testdoxTextFile, ?array $testSuffixes, ?string $testSuite, ?string $excludeTestSuite, bool $useDefaultConfiguration, ?bool $displayDetailsOnAllIssues, ?bool $displayDetailsOnIncompleteTests, ?bool $displayDetailsOnSkippedTests, ?bool $displayDetailsOnTestsThatTriggerDeprecations, ?bool $displayDetailsOnPhpunitDeprecations, ?bool $displayDetailsOnPhpunitNotices, ?bool $displayDetailsOnTestsThatTriggerErrors, ?bool $displayDetailsOnTestsThatTriggerNotices, ?bool $displayDetailsOnTestsThatTriggerWarnings, bool $version, ?array $coverageFilter, ?string $logEventsText, ?string $logEventsVerboseText, ?bool $printerTeamCity, ?bool $testdoxPrinter, ?bool $testdoxPrinterSummary, bool $debug, bool $withTelemetry, ?array $extensions) { $this->arguments = $arguments; $this->testFilesFile = $testFilesFile; @@ -1426,7 +1426,7 @@ public function hasStopOnDefect(): bool /** * @throws Exception */ - public function stopOnDefect(): bool + public function stopOnDefect(): int { if (!$this->hasStopOnDefect()) { throw new Exception; @@ -1446,7 +1446,7 @@ public function hasStopOnDeprecation(): bool /** * @throws Exception */ - public function stopOnDeprecation(): bool + public function stopOnDeprecation(): int { if (!$this->hasStopOnDeprecation()) { throw new Exception; @@ -1486,7 +1486,7 @@ public function hasStopOnError(): bool /** * @throws Exception */ - public function stopOnError(): bool + public function stopOnError(): int { if (!$this->hasStopOnError()) { throw new Exception; @@ -1506,7 +1506,7 @@ public function hasStopOnFailure(): bool /** * @throws Exception */ - public function stopOnFailure(): bool + public function stopOnFailure(): int { if (!$this->hasStopOnFailure()) { throw new Exception; @@ -1526,7 +1526,7 @@ public function hasStopOnIncomplete(): bool /** * @throws Exception */ - public function stopOnIncomplete(): bool + public function stopOnIncomplete(): int { if (!$this->hasStopOnIncomplete()) { throw new Exception; @@ -1546,7 +1546,7 @@ public function hasStopOnNotice(): bool /** * @throws Exception */ - public function stopOnNotice(): bool + public function stopOnNotice(): int { if (!$this->hasStopOnNotice()) { throw new Exception; @@ -1566,7 +1566,7 @@ public function hasStopOnRisky(): bool /** * @throws Exception */ - public function stopOnRisky(): bool + public function stopOnRisky(): int { if (!$this->hasStopOnRisky()) { throw new Exception; @@ -1586,7 +1586,7 @@ public function hasStopOnSkipped(): bool /** * @throws Exception */ - public function stopOnSkipped(): bool + public function stopOnSkipped(): int { if (!$this->hasStopOnSkipped()) { throw new Exception; @@ -1606,7 +1606,7 @@ public function hasStopOnWarning(): bool /** * @throws Exception */ - public function stopOnWarning(): bool + public function stopOnWarning(): int { if (!$this->hasStopOnWarning()) { throw new Exception; diff --git a/src/TextUI/Configuration/Configuration.php b/src/TextUI/Configuration/Configuration.php index c77fa952b9..10795feda3 100644 --- a/src/TextUI/Configuration/Configuration.php +++ b/src/TextUI/Configuration/Configuration.php @@ -97,16 +97,16 @@ private bool $doNotFailOnRisky; private bool $doNotFailOnSkipped; private bool $doNotFailOnWarning; - private bool $stopOnDefect; - private bool $stopOnDeprecation; + private int $stopOnDefect; + private int $stopOnDeprecation; private ?string $specificDeprecationToStopOn; - private bool $stopOnError; - private bool $stopOnFailure; - private bool $stopOnIncomplete; - private bool $stopOnNotice; - private bool $stopOnRisky; - private bool $stopOnSkipped; - private bool $stopOnWarning; + private int $stopOnError; + private int $stopOnFailure; + private int $stopOnIncomplete; + private int $stopOnNotice; + private int $stopOnRisky; + private int $stopOnSkipped; + private int $stopOnWarning; private bool $outputToStandardErrorStream; private int $columns; private bool $noExtensions; @@ -232,7 +232,7 @@ * @param null|non-empty-string $generateBaseline * @param non-negative-int $shortenArraysForExportThreshold */ - public function __construct(array $cliArguments, ?string $testFilesFile, ?string $configurationFile, ?string $bootstrap, array $bootstrapForTestSuite, bool $cacheResult, ?string $cacheDirectory, ?string $coverageCacheDirectory, Source $source, string $testResultCacheFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4j, int $coverageCrap4jThreshold, ?string $coverageHtml, int $coverageHtmlLowUpperBound, int $coverageHtmlHighLowerBound, string $coverageHtmlColorSuccessLow, string $coverageHtmlColorSuccessLowDark, string $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessMediumDark, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorSuccessHighDark, string $coverageHtmlColorSuccessBar, string $coverageHtmlColorSuccessBarDark, string $coverageHtmlColorWarning, string $coverageHtmlColorWarningDark, string $coverageHtmlColorWarningBar, string $coverageHtmlColorWarningBarDark, string $coverageHtmlColorDanger, string $coverageHtmlColorDangerDark, string $coverageHtmlColorDangerBar, string $coverageHtmlColorDangerBarDark, string $coverageHtmlColorBreadcrumbs, string $coverageHtmlColorBreadcrumbsDark, ?string $coverageHtmlCustomCssFile, ?string $coverageOpenClover, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $coverageXmlIncludeSource, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnAllIssues, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnPhpunitNotice, bool $failOnPhpunitWarning, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $doNotFailOnDeprecation, bool $doNotFailOnPhpunitDeprecation, bool $doNotFailOnPhpunitNotice, bool $doNotFailOnPhpunitWarning, bool $doNotFailOnEmptyTestSuite, bool $doNotFailOnIncomplete, bool $doNotFailOnNotice, bool $doNotFailOnRisky, bool $doNotFailOnSkipped, bool $doNotFailOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, ?string $specificDeprecationToStopOn, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, bool $outputToStandardErrorStream, int $columns, bool $noExtensions, ?string $pharExtensionDirectory, array $extensionBootstrappers, bool $backupGlobals, bool $backupStaticProperties, bool $beStrictAboutChangesToGlobalState, bool $colors, bool $processIsolation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, bool $reportUselessTests, bool $strictCoverage, bool $disallowTestOutput, bool $displayDetailsOnAllIssues, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnPhpunitNotices, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $requireSealedMockObjects, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileOtr, bool $includeGitInformation, bool $includeGitInformationInOtrLogfile, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, bool $testDoxOutputSummary, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, ?string $filter, ?string $excludeFilter, array $groups, array $excludeGroups, int $randomOrderSeed, bool $includeUncoveredFiles, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, bool $ignoreTestSelectionInXmlConfiguration, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline, bool $debug, bool $withTelemetry, int $shortenArraysForExportThreshold) + public function __construct(array $cliArguments, ?string $testFilesFile, ?string $configurationFile, ?string $bootstrap, array $bootstrapForTestSuite, bool $cacheResult, ?string $cacheDirectory, ?string $coverageCacheDirectory, Source $source, string $testResultCacheFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4j, int $coverageCrap4jThreshold, ?string $coverageHtml, int $coverageHtmlLowUpperBound, int $coverageHtmlHighLowerBound, string $coverageHtmlColorSuccessLow, string $coverageHtmlColorSuccessLowDark, string $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessMediumDark, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorSuccessHighDark, string $coverageHtmlColorSuccessBar, string $coverageHtmlColorSuccessBarDark, string $coverageHtmlColorWarning, string $coverageHtmlColorWarningDark, string $coverageHtmlColorWarningBar, string $coverageHtmlColorWarningBarDark, string $coverageHtmlColorDanger, string $coverageHtmlColorDangerDark, string $coverageHtmlColorDangerBar, string $coverageHtmlColorDangerBarDark, string $coverageHtmlColorBreadcrumbs, string $coverageHtmlColorBreadcrumbsDark, ?string $coverageHtmlCustomCssFile, ?string $coverageOpenClover, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $coverageXmlIncludeSource, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnAllIssues, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnPhpunitNotice, bool $failOnPhpunitWarning, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $doNotFailOnDeprecation, bool $doNotFailOnPhpunitDeprecation, bool $doNotFailOnPhpunitNotice, bool $doNotFailOnPhpunitWarning, bool $doNotFailOnEmptyTestSuite, bool $doNotFailOnIncomplete, bool $doNotFailOnNotice, bool $doNotFailOnRisky, bool $doNotFailOnSkipped, bool $doNotFailOnWarning, int $stopOnDefect, int $stopOnDeprecation, ?string $specificDeprecationToStopOn, int $stopOnError, int $stopOnFailure, int $stopOnIncomplete, int $stopOnNotice, int $stopOnRisky, int $stopOnSkipped, int $stopOnWarning, bool $outputToStandardErrorStream, int $columns, bool $noExtensions, ?string $pharExtensionDirectory, array $extensionBootstrappers, bool $backupGlobals, bool $backupStaticProperties, bool $beStrictAboutChangesToGlobalState, bool $colors, bool $processIsolation, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, bool $reportUselessTests, bool $strictCoverage, bool $disallowTestOutput, bool $displayDetailsOnAllIssues, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnPhpunitNotices, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $requireSealedMockObjects, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileOtr, bool $includeGitInformation, bool $includeGitInformationInOtrLogfile, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, bool $testDoxOutputSummary, ?array $testsCovering, ?array $testsUsing, ?array $testsRequiringPhpExtension, ?string $filter, ?string $excludeFilter, array $groups, array $excludeGroups, int $randomOrderSeed, bool $includeUncoveredFiles, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, bool $ignoreTestSelectionInXmlConfiguration, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline, bool $debug, bool $withTelemetry, int $shortenArraysForExportThreshold) { $this->cliArguments = $cliArguments; $this->testFilesFile = $testFilesFile; @@ -954,12 +954,38 @@ public function doNotFailOnWarning(): bool return $this->doNotFailOnWarning; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnDefect(): bool + { + return $this->stopOnDefect > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnDefectThreshold(): int { return $this->stopOnDefect; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnDeprecation(): bool + { + return $this->stopOnDeprecation > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnDeprecationThreshold(): int { return $this->stopOnDeprecation; } @@ -984,37 +1010,128 @@ public function specificDeprecationToStopOn(): string return $this->specificDeprecationToStopOn; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnError(): bool + { + return $this->stopOnError > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnErrorThreshold(): int { return $this->stopOnError; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnFailure(): bool + { + return $this->stopOnFailure > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnFailureThreshold(): int { return $this->stopOnFailure; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnIncomplete(): bool + { + return $this->stopOnIncomplete > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnIncompleteThreshold(): int { return $this->stopOnIncomplete; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnNotice(): bool + { + return $this->stopOnNotice > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnNoticeThreshold(): int { return $this->stopOnNotice; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnRisky(): bool + { + return $this->stopOnRisky > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnRiskyThreshold(): int { return $this->stopOnRisky; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnSkipped(): bool + { + return $this->stopOnSkipped > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnSkippedThreshold(): int { return $this->stopOnSkipped; } + /** + * @deprecated + * + * @codeCoverageIgnore + */ public function stopOnWarning(): bool + { + return $this->stopOnWarning > 0; + } + + /** + * @return non-negative-int + */ + public function stopOnWarningThreshold(): int { return $this->stopOnWarning; } diff --git a/src/TextUI/Configuration/Xml/DefaultConfiguration.php b/src/TextUI/Configuration/Xml/DefaultConfiguration.php index ed8acdd2b3..4d5d6e597b 100644 --- a/src/TextUI/Configuration/Xml/DefaultConfiguration.php +++ b/src/TextUI/Configuration/Xml/DefaultConfiguration.php @@ -133,15 +133,15 @@ public static function create(): self false, false, false, - false, - false, - false, - false, - false, - false, - false, - false, - false, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, null, false, false, diff --git a/src/TextUI/Configuration/Xml/Loader.php b/src/TextUI/Configuration/Xml/Loader.php index 1bb2ac4ef6..b51b65c73d 100644 --- a/src/TextUI/Configuration/Xml/Loader.php +++ b/src/TextUI/Configuration/Xml/Loader.php @@ -1000,15 +1000,15 @@ private function phpunit(string $filename, DOMDocument $document, DOMXPath $xpat $this->parseBooleanAttribute($document->documentElement, 'failOnRisky', false), $this->parseBooleanAttribute($document->documentElement, 'failOnSkipped', false), $this->parseBooleanAttribute($document->documentElement, 'failOnWarning', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnDefect', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnDeprecation', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnError', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnFailure', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnIncomplete', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnNotice', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnRisky', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnSkipped', false), - $this->parseBooleanAttribute($document->documentElement, 'stopOnWarning', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnDefect', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnDeprecation', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnError', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnFailure', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnIncomplete', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnNotice', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnRisky', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnSkipped', false), + (int) $this->parseBooleanAttribute($document->documentElement, 'stopOnWarning', false), $extensionsDirectory, $this->parseBooleanAttribute($document->documentElement, 'beStrictAboutChangesToGlobalState', false), $this->parseBooleanAttribute($document->documentElement, 'beStrictAboutOutputDuringTests', false), diff --git a/src/TextUI/Configuration/Xml/PHPUnit.php b/src/TextUI/Configuration/Xml/PHPUnit.php index dd6e290571..3814b1ae90 100644 --- a/src/TextUI/Configuration/Xml/PHPUnit.php +++ b/src/TextUI/Configuration/Xml/PHPUnit.php @@ -53,15 +53,15 @@ private bool $failOnRisky; private bool $failOnSkipped; private bool $failOnWarning; - private bool $stopOnDefect; - private bool $stopOnDeprecation; - private bool $stopOnError; - private bool $stopOnFailure; - private bool $stopOnIncomplete; - private bool $stopOnNotice; - private bool $stopOnRisky; - private bool $stopOnSkipped; - private bool $stopOnWarning; + private int $stopOnDefect; + private int $stopOnDeprecation; + private int $stopOnError; + private int $stopOnFailure; + private int $stopOnIncomplete; + private int $stopOnNotice; + private int $stopOnRisky; + private int $stopOnSkipped; + private int $stopOnWarning; /** * @var ?non-empty-string @@ -97,7 +97,7 @@ * @param ?non-empty-string $extensionsDirectory * @param non-negative-int $shortenArraysForExportThreshold */ - public function __construct(?string $cacheDirectory, bool $cacheResult, int|string $columns, string $colors, bool $stderr, bool $displayDetailsOnAllIssues, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnPhpunitNotices, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $requireSealedMockObjects, ?string $bootstrap, array $bootstrapForTestSuite, bool $processIsolation, bool $failOnAllIssues, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnPhpunitNotice, bool $failOnPhpunitWarning, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, bool $stopOnDefect, bool $stopOnDeprecation, bool $stopOnError, bool $stopOnFailure, bool $stopOnIncomplete, bool $stopOnNotice, bool $stopOnRisky, bool $stopOnSkipped, bool $stopOnWarning, ?string $extensionsDirectory, bool $beStrictAboutChangesToGlobalState, bool $beStrictAboutOutputDuringTests, bool $beStrictAboutTestsThatDoNotTestAnything, bool $beStrictAboutCoverageMetadata, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, ?string $defaultTestSuite, int $executionOrder, bool $resolveDependencies, bool $defectsFirst, bool $backupGlobals, bool $backupStaticProperties, bool $testdoxPrinter, bool $testdoxPrinterSummary, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, int $shortenArraysForExportThreshold) + public function __construct(?string $cacheDirectory, bool $cacheResult, int|string $columns, string $colors, bool $stderr, bool $displayDetailsOnAllIssues, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnPhpunitDeprecations, bool $displayDetailsOnPhpunitNotices, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $requireSealedMockObjects, ?string $bootstrap, array $bootstrapForTestSuite, bool $processIsolation, bool $failOnAllIssues, bool $failOnDeprecation, bool $failOnPhpunitDeprecation, bool $failOnPhpunitNotice, bool $failOnPhpunitWarning, bool $failOnEmptyTestSuite, bool $failOnIncomplete, bool $failOnNotice, bool $failOnRisky, bool $failOnSkipped, bool $failOnWarning, int $stopOnDefect, int $stopOnDeprecation, int $stopOnError, int $stopOnFailure, int $stopOnIncomplete, int $stopOnNotice, int $stopOnRisky, int $stopOnSkipped, int $stopOnWarning, ?string $extensionsDirectory, bool $beStrictAboutChangesToGlobalState, bool $beStrictAboutOutputDuringTests, bool $beStrictAboutTestsThatDoNotTestAnything, bool $beStrictAboutCoverageMetadata, bool $enforceTimeLimit, int $defaultTimeLimit, int $timeoutForSmallTests, int $timeoutForMediumTests, int $timeoutForLargeTests, ?string $defaultTestSuite, int $executionOrder, bool $resolveDependencies, bool $defectsFirst, bool $backupGlobals, bool $backupStaticProperties, bool $testdoxPrinter, bool $testdoxPrinterSummary, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, int $shortenArraysForExportThreshold) { $this->cacheDirectory = $cacheDirectory; $this->cacheResult = $cacheResult; @@ -350,47 +350,47 @@ public function failOnWarning(): bool return $this->failOnWarning; } - public function stopOnDefect(): bool + public function stopOnDefect(): int { return $this->stopOnDefect; } - public function stopOnDeprecation(): bool + public function stopOnDeprecation(): int { return $this->stopOnDeprecation; } - public function stopOnError(): bool + public function stopOnError(): int { return $this->stopOnError; } - public function stopOnFailure(): bool + public function stopOnFailure(): int { return $this->stopOnFailure; } - public function stopOnIncomplete(): bool + public function stopOnIncomplete(): int { return $this->stopOnIncomplete; } - public function stopOnNotice(): bool + public function stopOnNotice(): int { return $this->stopOnNotice; } - public function stopOnRisky(): bool + public function stopOnRisky(): int { return $this->stopOnRisky; } - public function stopOnSkipped(): bool + public function stopOnSkipped(): int { return $this->stopOnSkipped; } - public function stopOnWarning(): bool + public function stopOnWarning(): int { return $this->stopOnWarning; } diff --git a/src/TextUI/Help.php b/src/TextUI/Help.php index e9b7e0dfb5..a2452f86a2 100644 --- a/src/TextUI/Help.php +++ b/src/TextUI/Help.php @@ -203,15 +203,15 @@ private function elements(): array ['arg' => '--do-not-report-useless-tests', 'desc' => 'Do not report tests that do not test anything'], ['spacer' => ''], - ['arg' => '--stop-on-defect', 'desc' => 'Stop after first error, failure, warning, or risky test'], - ['arg' => '--stop-on-error', 'desc' => 'Stop after first error'], - ['arg' => '--stop-on-failure', 'desc' => 'Stop after first failure'], - ['arg' => '--stop-on-warning', 'desc' => 'Stop after first warning'], - ['arg' => '--stop-on-risky', 'desc' => 'Stop after first risky test'], - ['arg' => '--stop-on-deprecation', 'desc' => 'Stop after first test that triggered a deprecation'], - ['arg' => '--stop-on-notice', 'desc' => 'Stop after first test that triggered a notice'], - ['arg' => '--stop-on-skipped', 'desc' => 'Stop after first skipped test'], - ['arg' => '--stop-on-incomplete', 'desc' => 'Stop after first incomplete test'], + ['arg' => '--stop-on-defect[=]', 'desc' => 'Stop after first (or n-th) error, failure, warning, or risky test'], + ['arg' => '--stop-on-error[=]', 'desc' => 'Stop after first (or n-th) error'], + ['arg' => '--stop-on-failure[=]', 'desc' => 'Stop after first (or n-th) failure'], + ['arg' => '--stop-on-warning[=]', 'desc' => 'Stop after first (or n-th) warning'], + ['arg' => '--stop-on-risky[=]', 'desc' => 'Stop after first (or n-th) risky test'], + ['arg' => '--stop-on-deprecation[=]', 'desc' => 'Stop after first (or n-th) test that triggered a deprecation'], + ['arg' => '--stop-on-notice[=]', 'desc' => 'Stop after first (or n-th) test that triggered a notice'], + ['arg' => '--stop-on-skipped[=]', 'desc' => 'Stop after first (or n-th) skipped test'], + ['arg' => '--stop-on-incomplete[=]', 'desc' => 'Stop after first (or n-th) incomplete test'], ['spacer' => ''], ['arg' => '--fail-on-empty-test-suite', 'desc' => 'Signal failure using shell exit code when no tests were run'], diff --git a/tests/end-to-end/_files/output-cli-help-color.txt b/tests/end-to-end/_files/output-cli-help-color.txt index bec5c24fa8..a9999686dd 100644 --- a/tests/end-to-end/_files/output-cli-help-color.txt +++ b/tests/end-to-end/_files/output-cli-help-color.txt @@ -71,18 +71,19 @@ --do-not-report-useless-tests  Do not report tests that do not test anything - --stop-on-defect  Stop after first error, failure, - warning, or risky test - --stop-on-error  Stop after first error - --stop-on-failure  Stop after first failure - --stop-on-warning  Stop after first warning - --stop-on-risky  Stop after first risky test - --stop-on-deprecation  Stop after first test that triggered a - deprecation - --stop-on-notice  Stop after first test that triggered a - notice - --stop-on-skipped  Stop after first skipped test - --stop-on-incomplete  Stop after first incomplete test + --stop-on-defect[=]  Stop after first (or n-th) error, + failure, warning, or risky test + --stop-on-error[=]  Stop after first (or n-th) error + --stop-on-failure[=]  Stop after first (or n-th) failure + --stop-on-warning[=]  Stop after first (or n-th) warning + --stop-on-risky[=]  Stop after first (or n-th) risky test + --stop-on-deprecation[=]  Stop after first (or n-th) test that + triggered a deprecation + --stop-on-notice[=]  Stop after first (or n-th) test that + triggered a notice + --stop-on-skipped[=]  Stop after first (or n-th) skipped test + --stop-on-incomplete[=]  Stop after first (or n-th) incomplete + test --fail-on-empty-test-suite  Signal failure using shell exit code when no tests were run diff --git a/tests/end-to-end/_files/output-cli-usage.txt b/tests/end-to-end/_files/output-cli-usage.txt index e1c1c32cd8..423885c573 100644 --- a/tests/end-to-end/_files/output-cli-usage.txt +++ b/tests/end-to-end/_files/output-cli-usage.txt @@ -52,15 +52,15 @@ Execution: --default-time-limit Timeout in seconds for tests that have no declared size --do-not-report-useless-tests Do not report tests that do not test anything - --stop-on-defect Stop after first error, failure, warning, or risky test - --stop-on-error Stop after first error - --stop-on-failure Stop after first failure - --stop-on-warning Stop after first warning - --stop-on-risky Stop after first risky test - --stop-on-deprecation Stop after first test that triggered a deprecation - --stop-on-notice Stop after first test that triggered a notice - --stop-on-skipped Stop after first skipped test - --stop-on-incomplete Stop after first incomplete test + --stop-on-defect[=] Stop after first (or n-th) error, failure, warning, or risky test + --stop-on-error[=] Stop after first (or n-th) error + --stop-on-failure[=] Stop after first (or n-th) failure + --stop-on-warning[=] Stop after first (or n-th) warning + --stop-on-risky[=] Stop after first (or n-th) risky test + --stop-on-deprecation[=] Stop after first (or n-th) test that triggered a deprecation + --stop-on-notice[=] Stop after first (or n-th) test that triggered a notice + --stop-on-skipped[=] Stop after first (or n-th) skipped test + --stop-on-incomplete[=] Stop after first (or n-th) incomplete test --fail-on-empty-test-suite Signal failure using shell exit code when no tests were run --fail-on-warning Signal failure using shell exit code when a warning was triggered diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleDefectTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleDefectTest.php new file mode 100644 index 0000000000..096f5ff1ed --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleDefectTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use const E_USER_WARNING; +use function trigger_error; +use Exception; +use PHPUnit\Framework\TestCase; + +final class MultipleDefectTest extends TestCase +{ + public function testOne(): void + { + $this->assertTrue(false); + } + + public function testTwo(): void + { + throw new Exception('message'); + } + + public function testThree(): void + { + trigger_error('message', E_USER_WARNING); + + $this->assertTrue(true); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleErrorTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleErrorTest.php new file mode 100644 index 0000000000..efc8c3d135 --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleErrorTest.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use Exception; +use PHPUnit\Framework\TestCase; + +final class MultipleErrorTest extends TestCase +{ + public function testOne(): void + { + throw new Exception('message'); + } + + public function testTwo(): void + { + throw new Exception('message'); + } + + public function testThree(): void + { + throw new Exception('message'); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleFailureTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleFailureTest.php new file mode 100644 index 0000000000..cd9b6bb389 --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleFailureTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use PHPUnit\Framework\TestCase; + +final class MultipleFailureTest extends TestCase +{ + public function testOne(): void + { + $this->assertTrue(false); + } + + public function testTwo(): void + { + $this->assertTrue(false); + } + + public function testThree(): void + { + $this->assertTrue(false); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleIncompleteTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleIncompleteTest.php new file mode 100644 index 0000000000..f72ee6bc7e --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleIncompleteTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use PHPUnit\Framework\TestCase; + +final class MultipleIncompleteTest extends TestCase +{ + public function testOne(): void + { + $this->markTestIncomplete('message'); + } + + public function testTwo(): void + { + $this->markTestIncomplete('message'); + } + + public function testThree(): void + { + $this->markTestIncomplete('message'); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleNoticeTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleNoticeTest.php new file mode 100644 index 0000000000..802bf4831d --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleNoticeTest.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use const E_USER_NOTICE; +use function trigger_error; +use PHPUnit\Framework\TestCase; + +final class MultipleNoticeTest extends TestCase +{ + public function testOne(): void + { + trigger_error('message', E_USER_NOTICE); + + $this->assertTrue(true); + } + + public function testTwo(): void + { + trigger_error('message', E_USER_NOTICE); + + $this->assertTrue(true); + } + + public function testThree(): void + { + trigger_error('message', E_USER_NOTICE); + + $this->assertTrue(true); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleRiskyTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleRiskyTest.php new file mode 100644 index 0000000000..3abdfcd279 --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleRiskyTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use PHPUnit\Framework\TestCase; + +final class MultipleRiskyTest extends TestCase +{ + public function testOne(): void + { + } + + public function testTwo(): void + { + } + + public function testThree(): void + { + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleSkippedTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleSkippedTest.php new file mode 100644 index 0000000000..3e12326a4b --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleSkippedTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use PHPUnit\Framework\TestCase; + +final class MultipleSkippedTest extends TestCase +{ + public function testOne(): void + { + $this->markTestSkipped('message'); + } + + public function testTwo(): void + { + $this->markTestSkipped('message'); + } + + public function testThree(): void + { + $this->markTestSkipped('message'); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/_files/stop-on-fail-on/MultipleWarningTest.php b/tests/end-to-end/_files/stop-on-fail-on/MultipleWarningTest.php new file mode 100644 index 0000000000..c1fd2dc27c --- /dev/null +++ b/tests/end-to-end/_files/stop-on-fail-on/MultipleWarningTest.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\TestRunnerStopping; + +use const E_USER_WARNING; +use function trigger_error; +use PHPUnit\Framework\TestCase; + +final class MultipleWarningTest extends TestCase +{ + public function testOne(): void + { + trigger_error('message', E_USER_WARNING); + + $this->assertTrue(true); + } + + public function testTwo(): void + { + trigger_error('message', E_USER_WARNING); + + $this->assertTrue(true); + } + + public function testThree(): void + { + trigger_error('message', E_USER_WARNING); + + $this->assertTrue(true); + } + + public function testFour(): void + { + $this->assertTrue(true); + } +} diff --git a/tests/end-to-end/cli/stop-on/stop-on-defect-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-defect-with-threshold.phpt new file mode 100644 index 0000000000..b72327a5bf --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-defect-with-threshold.phpt @@ -0,0 +1,37 @@ +--TEST-- +Stopping test execution after second defect (across types) works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testOne) +Test Failed (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testOne) +Failed asserting that false is true. +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testTwo) +Test Errored (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testTwo) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleDefectTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 2) diff --git a/tests/end-to-end/cli/stop-on/stop-on-error-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-error-with-threshold.phpt new file mode 100644 index 0000000000..daa4faad28 --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-error-with-threshold.phpt @@ -0,0 +1,37 @@ +--TEST-- +Stopping test execution after second error works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testOne) +Test Errored (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testOne) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testTwo) +Test Errored (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testTwo) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleErrorTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 2) diff --git a/tests/end-to-end/cli/stop-on/stop-on-failure-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-failure-with-threshold.phpt new file mode 100644 index 0000000000..c96ce170b9 --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-failure-with-threshold.phpt @@ -0,0 +1,37 @@ +--TEST-- +Stopping test execution after second failure works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testOne) +Test Failed (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testOne) +Failed asserting that false is true. +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testTwo) +Test Failed (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testTwo) +Failed asserting that false is true. +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleFailureTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 1) diff --git a/tests/end-to-end/cli/stop-on/stop-on-incomplete-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-incomplete-with-threshold.phpt new file mode 100644 index 0000000000..63dffb68d9 --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-incomplete-with-threshold.phpt @@ -0,0 +1,37 @@ +--TEST-- +Stopping test execution after second incomplete test works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testOne) +Test Marked Incomplete (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testOne) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testTwo) +Test Marked Incomplete (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testTwo) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleIncompleteTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/cli/stop-on/stop-on-notice-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-notice-with-threshold.phpt new file mode 100644 index 0000000000..07a00363ac --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-notice-with-threshold.phpt @@ -0,0 +1,39 @@ +--TEST-- +Stopping test execution after second notice works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testOne) +Test Triggered Notice (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testOne) in %sMultipleNoticeTest.php:%d +message +Test Passed (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testOne) +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testTwo) +Test Triggered Notice (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testTwo) in %sMultipleNoticeTest.php:%d +message +Test Passed (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testTwo) +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleNoticeTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/cli/stop-on/stop-on-risky-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-risky-with-threshold.phpt new file mode 100644 index 0000000000..ebb790f447 --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-risky-with-threshold.phpt @@ -0,0 +1,39 @@ +--TEST-- +Stopping test execution after second risky test works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testOne) +Test Passed (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testOne) +Test Considered Risky (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testOne) +This test did not perform any assertions +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testTwo) +Test Passed (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testTwo) +Test Considered Risky (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testTwo) +This test did not perform any assertions +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleRiskyTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/cli/stop-on/stop-on-skipped-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-skipped-with-threshold.phpt new file mode 100644 index 0000000000..ba90021096 --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-skipped-with-threshold.phpt @@ -0,0 +1,37 @@ +--TEST-- +Stopping test execution after second skipped test works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testOne) +Test Skipped (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testOne) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testTwo) +Test Skipped (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testTwo) +message +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleSkippedTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/end-to-end/cli/stop-on/stop-on-warning-with-threshold.phpt b/tests/end-to-end/cli/stop-on/stop-on-warning-with-threshold.phpt new file mode 100644 index 0000000000..37b38b1a7a --- /dev/null +++ b/tests/end-to-end/cli/stop-on/stop-on-warning-with-threshold.phpt @@ -0,0 +1,39 @@ +--TEST-- +Stopping test execution after second warning works +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit Started (PHPUnit %s using %s) +Test Runner Configured +Event Facade Sealed +Test Suite Loaded (4 tests) +Test Runner Started +Test Suite Sorted +Test Runner Execution Started (4 tests) +Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest, 4 tests) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testOne) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testOne) +Test Triggered Warning (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testOne) in %sMultipleWarningTest.php:%d +message +Test Passed (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testOne) +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testOne) +Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testTwo) +Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testTwo) +Test Triggered Warning (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testTwo) in %sMultipleWarningTest.php:%d +message +Test Passed (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testTwo) +Test Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest::testTwo) +Test Runner Execution Aborted +Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\MultipleWarningTest, 4 tests) +Test Runner Execution Finished +Test Runner Finished +PHPUnit Finished (Shell Exit Code: 0) diff --git a/tests/unit/TextUI/Configuration/Cli/BuilderTest.php b/tests/unit/TextUI/Configuration/Cli/BuilderTest.php index 6a1db708de..8948444fe1 100644 --- a/tests/unit/TextUI/Configuration/Cli/BuilderTest.php +++ b/tests/unit/TextUI/Configuration/Cli/BuilderTest.php @@ -1793,7 +1793,16 @@ public function testStopOnDefect(): void $configuration = (new Builder)->fromParameters(['--stop-on-defect']); $this->assertTrue($configuration->hasStopOnDefect()); - $this->assertTrue($configuration->stopOnDefect()); + $this->assertSame(1, $configuration->stopOnDefect()); + } + + #[TestDox('--stop-on-defect=')] + public function testStopOnDefectWithThreshold(): void + { + $configuration = (new Builder)->fromParameters(['--stop-on-defect=5']); + + $this->assertTrue($configuration->hasStopOnDefect()); + $this->assertSame(5, $configuration->stopOnDefect()); } public function testStopOnDefectMayNotBeConfigured(): void @@ -1813,7 +1822,7 @@ public function testStopOnDeprecation(): void $configuration = (new Builder)->fromParameters(['--stop-on-deprecation']); $this->assertTrue($configuration->hasStopOnDeprecation()); - $this->assertTrue($configuration->stopOnDeprecation()); + $this->assertSame(1, $configuration->stopOnDeprecation()); $this->expectException(Exception::class); @@ -1826,11 +1835,21 @@ public function testStopOnDeprecationMessage(): void $configuration = (new Builder)->fromParameters(['--stop-on-deprecation=message']); $this->assertTrue($configuration->hasStopOnDeprecation()); - $this->assertTrue($configuration->stopOnDeprecation()); + $this->assertSame(1, $configuration->stopOnDeprecation()); $this->assertTrue($configuration->hasSpecificDeprecationToStopOn()); $this->assertSame('message', $configuration->specificDeprecationToStopOn()); } + #[TestDox('--stop-on-deprecation=')] + public function testStopOnDeprecationWithThreshold(): void + { + $configuration = (new Builder)->fromParameters(['--stop-on-deprecation=3']); + + $this->assertTrue($configuration->hasStopOnDeprecation()); + $this->assertSame(3, $configuration->stopOnDeprecation()); + $this->assertFalse($configuration->hasSpecificDeprecationToStopOn()); + } + public function testStopOnDeprecationMayNotBeConfigured(): void { $configuration = (new Builder)->fromParameters([]); @@ -1848,7 +1867,7 @@ public function testStopOnError(): void $configuration = (new Builder)->fromParameters(['--stop-on-error']); $this->assertTrue($configuration->hasStopOnError()); - $this->assertTrue($configuration->stopOnError()); + $this->assertSame(1, $configuration->stopOnError()); } public function testStopOnErrorMayNotBeConfigured(): void @@ -1868,7 +1887,7 @@ public function testStopOnFailure(): void $configuration = (new Builder)->fromParameters(['--stop-on-failure']); $this->assertTrue($configuration->hasStopOnFailure()); - $this->assertTrue($configuration->stopOnFailure()); + $this->assertSame(1, $configuration->stopOnFailure()); } public function testStopOnFailureMayNotBeConfigured(): void @@ -1888,7 +1907,7 @@ public function testStopOnIncomplete(): void $configuration = (new Builder)->fromParameters(['--stop-on-incomplete']); $this->assertTrue($configuration->hasStopOnIncomplete()); - $this->assertTrue($configuration->stopOnIncomplete()); + $this->assertSame(1, $configuration->stopOnIncomplete()); } public function testStopOnIncompleteMayNotBeConfigured(): void @@ -1908,7 +1927,7 @@ public function testStopOnNotice(): void $configuration = (new Builder)->fromParameters(['--stop-on-notice']); $this->assertTrue($configuration->hasStopOnNotice()); - $this->assertTrue($configuration->stopOnNotice()); + $this->assertSame(1, $configuration->stopOnNotice()); } public function testStopOnNoticeMayNotBeConfigured(): void @@ -1928,7 +1947,7 @@ public function testStopOnRisky(): void $configuration = (new Builder)->fromParameters(['--stop-on-risky']); $this->assertTrue($configuration->hasStopOnRisky()); - $this->assertTrue($configuration->stopOnRisky()); + $this->assertSame(1, $configuration->stopOnRisky()); } public function testStopOnRiskyMayNotBeConfigured(): void @@ -1948,7 +1967,7 @@ public function testStopOnSkipped(): void $configuration = (new Builder)->fromParameters(['--stop-on-skipped']); $this->assertTrue($configuration->hasStopOnSkipped()); - $this->assertTrue($configuration->stopOnSkipped()); + $this->assertSame(1, $configuration->stopOnSkipped()); } public function testStopOnSkippedMayNotBeConfigured(): void @@ -1968,7 +1987,7 @@ public function testStopOnWarning(): void $configuration = (new Builder)->fromParameters(['--stop-on-warning']); $this->assertTrue($configuration->hasStopOnWarning()); - $this->assertTrue($configuration->stopOnWarning()); + $this->assertSame(1, $configuration->stopOnWarning()); } public function testStopOnWarningMayNotBeConfigured(): void diff --git a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php index dbdca862ef..504f12d445 100644 --- a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php +++ b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php @@ -366,8 +366,8 @@ public function testPHPUnitConfigurationIsReadCorrectly(): void $this->assertSame('never', $phpunit->colors()); $this->assertFalse($phpunit->stderr()); $this->assertFalse($phpunit->requireCoverageMetadata()); - $this->assertFalse($phpunit->stopOnFailure()); - $this->assertFalse($phpunit->stopOnWarning()); + $this->assertSame(0, $phpunit->stopOnFailure()); + $this->assertSame(0, $phpunit->stopOnWarning()); $this->assertFalse($phpunit->beStrictAboutTestsThatDoNotTestAnything()); $this->assertFalse($phpunit->beStrictAboutCoverageMetadata()); $this->assertFalse($phpunit->beStrictAboutOutputDuringTests());