Skip to content

Commit

Permalink
Merge branch 'main' into list-test-files-new
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/TextUI/Configuration/Cli/Configuration.php
  • Loading branch information
joke2k committed Jan 9, 2024
2 parents d3350f1 + 9a57a3a commit d387c7d
Show file tree
Hide file tree
Showing 22 changed files with 367 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpab" version="^1.25" installed="1.29.0" location="./tools/phpab" copy="true"/>
<phar name="php-cs-fixer" version="^3.0" installed="3.45.0" location="./tools/php-cs-fixer" copy="true"/>
<phar name="php-cs-fixer" version="^3.0" installed="3.46.0" location="./tools/php-cs-fixer" copy="true"/>
<phar name="psalm" version="^5.0" installed="5.18.0" location="./tools/psalm" copy="true"/>
<phar name="humbug/php-scoper" version="^0.18" installed="0.18.10" location="./tools/php-scoper" copy="true"/>
<phar name="composer" version="^2.0.3" installed="2.6.6" location="./tools/composer" copy="true"/>
Expand Down
172 changes: 86 additions & 86 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @codeCoverageIgnore
*/
final readonly class Php81GarbageCollectorStatusProvider implements GarbageCollectorStatusProvider
{
Expand Down
2 changes: 2 additions & 0 deletions src/Event/Value/Telemetry/SystemStopWatchWithOffset.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*
* @codeCoverageIgnore
*/
final class SystemStopWatchWithOffset implements StopWatch
{
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Value/TestSuite/TestSuiteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function from(FrameworkTestSuite $testSuite): TestSuite
*/
private static function process(FrameworkTestSuite $testSuite, &$tests): void
{
foreach ($testSuite->tests() as $test) {
foreach ($testSuite->getIterator() as $test) {
if ($test instanceof FrameworkTestSuite) {
self::process($test, $tests);

Expand Down
11 changes: 10 additions & 1 deletion src/TextUI/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,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
55 changes: 27 additions & 28 deletions src/TextUI/Configuration/Cli/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
use function getcwd;
use function is_file;
use function is_numeric;
use function realpath;
use function sprintf;
use function str_starts_with;
use PHPUnit\Runner\TestSuiteSorter;
use PHPUnit\Util\Filesystem;
use SebastianBergmann\CliParser\Exception as CliParserException;
use SebastianBergmann\CliParser\Parser as CliParser;

Expand Down Expand Up @@ -124,6 +123,7 @@
'log-events-text=',
'log-events-verbose-text=',
'version',
'debug',
];
private const SHORT_OPTIONS = 'd:c:h';

Expand Down Expand Up @@ -242,6 +242,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 @@ -805,39 +806,36 @@ public function fromParameters(array $parameters): Configuration
break;

case '--log-events-text':
if (str_starts_with($option[1], 'php://') || str_starts_with($option[1], 'socket://')) {
$logEventsText = $option[1];
} else {
$logEventsText = realpath($option[1]);

if (!$logEventsText) {
throw new Exception(
sprintf(
'The path "%s" specified for the --log-events-text option could not be resolved',
$option[1],
),
);
}
$logEventsText = Filesystem::resolvePathOrStream($option[1]);

if (!$logEventsText) {
throw new Exception(
sprintf(
'The path "%s" specified for the --log-events-text option could not be resolved',
$option[1],
),
);
}

break;

case '--log-events-verbose-text':
if (str_starts_with($option[1], 'php://') || str_starts_with($option[1], 'socket://')) {
$logEventsVerboseText = $option[1];
} else {
$logEventsVerboseText = realpath($option[1]);

if (!$logEventsVerboseText) {
throw new Exception(
sprintf(
'The path "%s" specified for the --log-events-verbose-text option could not be resolved',
$option[1],
),
);
}
$logEventsVerboseText = Filesystem::resolvePathOrStream($option[1]);

if (!$logEventsVerboseText) {
throw new Exception(
sprintf(
'The path "%s" specified for the --log-events-verbose-text option could not be resolved',
$option[1],
),
);
}

break;

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

break;
}
}
Expand Down Expand Up @@ -948,6 +946,7 @@ public function fromParameters(array $parameters): Configuration
$logEventsVerboseText,
$printerTeamCity,
$printerTestDox,
$debug,
);
}
}
9 changes: 8 additions & 1 deletion src/TextUI/Configuration/Cli/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,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 $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 $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 $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 $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 @@ -224,6 +225,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 @@ -1975,4 +1977,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,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
Loading

0 comments on commit d387c7d

Please sign in to comment.