Skip to content

Commit

Permalink
Merge branch '10.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 7, 2024
2 parents a660415 + 43ee0fe commit 3ec8692
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/TextUI/Application.php
Expand Up @@ -142,14 +142,23 @@ public function run(array $argv): int
$extensionReplacesResultOutput,
);

if (!$extensionReplacesOutput) {
if (!$configuration->debug() && !$extensionReplacesOutput) {
$this->writeRuntimeInformation($printer, $configuration);
$this->writePharExtensionInformation($printer, $pharExtensions);
$this->writeRandomSeedInformation($printer, $configuration);

$printer->print(PHP_EOL);
}

if ($configuration->debug()) {
EventFacade::instance()->registerTracer(
new EventLogger(
'php://stdout',
false,
),
);
}

$this->registerLogfileWriters($configuration);

$testDoxResultCollector = $this->testDoxResultCollector($configuration);
Expand Down
8 changes: 8 additions & 0 deletions src/TextUI/Configuration/Cli/Builder.php
Expand Up @@ -122,6 +122,7 @@
'log-events-text=',
'log-events-verbose-text=',
'version',
'debug',
];
private const SHORT_OPTIONS = 'd:c:h';

Expand Down Expand Up @@ -239,6 +240,7 @@ public function fromParameters(array $parameters): Configuration
$logEventsVerboseText = null;
$printerTeamCity = null;
$printerTestDox = null;
$debug = false;

foreach ($options[0] as $option) {
switch ($option[0]) {
Expand Down Expand Up @@ -822,6 +824,11 @@ public function fromParameters(array $parameters): Configuration
);
}

break;

case '--debug':
$debug = true;

break;
}
}
Expand Down Expand Up @@ -931,6 +938,7 @@ public function fromParameters(array $parameters): Configuration
$logEventsVerboseText,
$printerTeamCity,
$printerTestDox,
$debug,
);
}
}
9 changes: 8 additions & 1 deletion src/TextUI/Configuration/Cli/Configuration.php
Expand Up @@ -119,12 +119,13 @@
private bool $version;
private ?string $logEventsText;
private ?string $logEventsVerboseText;
private bool $debug;

/**
* @psalm-param list<non-empty-string> $arguments
* @psalm-param ?non-empty-list<non-empty-string> $testSuffixes
*/
public function __construct(array $arguments, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticProperties, ?bool $beStrictAboutChangesToGlobalState, ?string $bootstrap, ?string $cacheDirectory, ?bool $cacheResult, bool $checkVersion, ?string $colors, null|int|string $columns, ?string $configurationFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, bool $warmCoverageCache, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?bool $failOnDeprecation, ?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 $filter, ?string $excludeFilter, ?string $generateBaseline, ?string $useBaseline, bool $ignoreBaseline, bool $generateConfiguration, bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, bool $listGroups, bool $listSuites, 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 $displayDetailsOnIncompleteTests, ?bool $displayDetailsOnSkippedTests, ?bool $displayDetailsOnTestsThatTriggerDeprecations, ?bool $displayDetailsOnTestsThatTriggerErrors, ?bool $displayDetailsOnTestsThatTriggerNotices, ?bool $displayDetailsOnTestsThatTriggerWarnings, bool $version, ?array $coverageFilter, ?string $logEventsText, ?string $logEventsVerboseText, ?bool $printerTeamCity, ?bool $printerTestDox)
public function __construct(array $arguments, ?string $atLeastVersion, ?bool $backupGlobals, ?bool $backupStaticProperties, ?bool $beStrictAboutChangesToGlobalState, ?string $bootstrap, ?string $cacheDirectory, ?bool $cacheResult, bool $checkVersion, ?string $colors, null|int|string $columns, ?string $configurationFile, ?string $coverageClover, ?string $coverageCobertura, ?string $coverageCrap4J, ?string $coverageHtml, ?string $coveragePhp, ?string $coverageText, ?bool $coverageTextShowUncoveredFiles, ?bool $coverageTextShowOnlySummary, ?string $coverageXml, ?bool $pathCoverage, bool $warmCoverageCache, ?int $defaultTimeLimit, ?bool $disableCodeCoverageIgnore, ?bool $disallowTestOutput, ?bool $enforceTimeLimit, ?array $excludeGroups, ?int $executionOrder, ?int $executionOrderDefects, ?bool $failOnDeprecation, ?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 $filter, ?string $excludeFilter, ?string $generateBaseline, ?string $useBaseline, bool $ignoreBaseline, bool $generateConfiguration, bool $migrateConfiguration, ?array $groups, ?array $testsCovering, ?array $testsUsing, bool $help, ?string $includePath, ?array $iniSettings, ?string $junitLogfile, bool $listGroups, bool $listSuites, 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 $displayDetailsOnIncompleteTests, ?bool $displayDetailsOnSkippedTests, ?bool $displayDetailsOnTestsThatTriggerDeprecations, ?bool $displayDetailsOnTestsThatTriggerErrors, ?bool $displayDetailsOnTestsThatTriggerNotices, ?bool $displayDetailsOnTestsThatTriggerWarnings, bool $version, ?array $coverageFilter, ?string $logEventsText, ?string $logEventsVerboseText, ?bool $printerTeamCity, ?bool $printerTestDox, bool $debug)
{
$this->arguments = $arguments;
$this->atLeastVersion = $atLeastVersion;
Expand Down Expand Up @@ -222,6 +223,7 @@ public function __construct(array $arguments, ?string $atLeastVersion, ?bool $ba
$this->logEventsVerboseText = $logEventsVerboseText;
$this->teamCityPrinter = $printerTeamCity;
$this->testdoxPrinter = $printerTestDox;
$this->debug = $debug;
}

/**
Expand Down Expand Up @@ -1968,4 +1970,9 @@ public function logEventsVerboseText(): string

return $this->logEventsVerboseText;
}

public function debug(): bool
{
return $this->debug;
}
}
9 changes: 8 additions & 1 deletion src/TextUI/Configuration/Configuration.php
Expand Up @@ -138,14 +138,15 @@
private bool $controlGarbageCollector;
private int $numberOfTestsBeforeGarbageCollection;
private ?string $generateBaseline;
private bool $debug;

/**
* @psalm-param list<non-empty-string> $cliArguments
* @psalm-param ?non-empty-string $pharExtensionDirectory
* @psalm-param non-empty-list<non-empty-string> $testSuffixes
* @psalm-param list<array{className: class-string, parameters: array<string, string>}> $extensionBootstrappers
*/
public function __construct(array $cliArguments, ?string $configurationFile, ?string $bootstrap, 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 $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorWarning, string $coverageHtmlColorDanger, ?string $coverageHtmlCustomCssFile, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnDeprecation, 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, bool $outputToStandardErrorStream, int|string $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 $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, ?array $testsCovering, ?array $testsUsing, ?string $filter, ?string $excludeFilter, ?array $groups, ?array $excludeGroups, int $randomOrderSeed, bool $includeUncoveredFiles, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline)
public function __construct(array $cliArguments, ?string $configurationFile, ?string $bootstrap, 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 $coverageHtmlColorSuccessMedium, string $coverageHtmlColorSuccessHigh, string $coverageHtmlColorWarning, string $coverageHtmlColorDanger, ?string $coverageHtmlCustomCssFile, ?string $coveragePhp, ?string $coverageText, bool $coverageTextShowUncoveredFiles, bool $coverageTextShowOnlySummary, ?string $coverageXml, bool $pathCoverage, bool $ignoreDeprecatedCodeUnitsFromCodeCoverage, bool $disableCodeCoverageIgnore, bool $failOnDeprecation, 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, bool $outputToStandardErrorStream, int|string $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 $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, bool $noProgress, bool $noResults, bool $noOutput, int $executionOrder, int $executionOrderDefects, bool $resolveDependencies, ?string $logfileTeamcity, ?string $logfileJunit, ?string $logfileTestdoxHtml, ?string $logfileTestdoxText, ?string $logEventsText, ?string $logEventsVerboseText, bool $teamCityOutput, bool $testDoxOutput, ?array $testsCovering, ?array $testsUsing, ?string $filter, ?string $excludeFilter, ?array $groups, ?array $excludeGroups, int $randomOrderSeed, bool $includeUncoveredFiles, TestSuiteCollection $testSuite, string $includeTestSuite, string $excludeTestSuite, ?string $defaultTestSuite, array $testSuffixes, Php $php, bool $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, ?string $generateBaseline, bool $debug)
{
$this->cliArguments = $cliArguments;
$this->configurationFile = $configurationFile;
Expand Down Expand Up @@ -249,6 +250,7 @@ public function __construct(array $cliArguments, ?string $configurationFile, ?st
$this->controlGarbageCollector = $controlGarbageCollector;
$this->numberOfTestsBeforeGarbageCollection = $numberOfTestsBeforeGarbageCollection;
$this->generateBaseline = $generateBaseline;
$this->debug = $debug;
}

/**
Expand Down Expand Up @@ -1199,4 +1201,9 @@ public function generateBaseline(): string

return $this->generateBaseline;
}

public function debug(): bool
{
return $this->debug;
}
}
1 change: 1 addition & 0 deletions src/TextUI/Configuration/Merger.php
Expand Up @@ -830,6 +830,7 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC
$xmlConfiguration->phpunit()->controlGarbageCollector(),
$xmlConfiguration->phpunit()->numberOfTestsBeforeGarbageCollection(),
$generateBaseline,
$cliConfiguration->debug(),
);
}
}
7 changes: 5 additions & 2 deletions src/TextUI/Help.php
Expand Up @@ -125,8 +125,11 @@ final class Help
['arg' => '--reverse-list', 'desc' => 'Print defects in reverse order'],
['spacer' => ''],

['arg' => '--teamcity', 'desc' => 'Replace default progress and result output with TeamCity format'],
['arg' => '--testdox', 'desc' => 'Replace default result output with TestDox format'],
['arg' => '--teamcity', 'desc' => 'Replace default progress and result output with TeamCity format'],
['arg' => '--testdox', 'desc' => 'Replace default result output with TestDox format'],
['spacer' => ''],

['arg' => '--debug', 'desc' => 'Replace default progress and result output with debugging information'],
],

'Logging' => [
Expand Down
8 changes: 8 additions & 0 deletions src/TextUI/Output/Facade.php
Expand Up @@ -47,6 +47,10 @@ public static function init(Configuration $configuration, bool $extensionReplace

assert(self::$printer !== null);

if ($configuration->debug()) {
return self::$printer;
}

self::createUnexpectedOutputPrinter();

if (!$extensionReplacesProgressOutput) {
Expand Down Expand Up @@ -117,6 +121,10 @@ private static function createPrinter(Configuration $configuration): void
{
$printerNeeded = false;

if ($configuration->debug()) {
$printerNeeded = true;
}

if ($configuration->outputIsTeamCity()) {
$printerNeeded = true;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/end-to-end/_files/output-cli-help-color.txt
Expand Up @@ -120,6 +120,9 @@
--testdox  Replace default result output with TestDox
format

--debug  Replace default progress and result output
with debugging information

Logging:

--log-junit <file>  Write test results in JUnit XML format to
Expand Down
2 changes: 2 additions & 0 deletions tests/end-to-end/_files/output-cli-usage.txt
Expand Up @@ -92,6 +92,8 @@ Reporting:
--teamcity Replace default progress and result output with TeamCity format
--testdox Replace default result output with TestDox format

--debug Replace default progress and result output with debugging information

Logging:

--log-junit <file> Write test results in JUnit XML format to file
Expand Down

0 comments on commit 3ec8692

Please sign in to comment.