Skip to content

Commit 2f90849

Browse files
Closes #6597
1 parent 8016bed commit 2f90849

41 files changed

Lines changed: 1488 additions & 14 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog-13.2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ All notable changes of the PHPUnit 13.2 release series are documented in this fi
2525
* [#6575](https://github.com/sebastianbergmann/phpunit/issues/6575): `--list-test-ids` CLI option and enhance `--filter` CLI option to support test ID syntax
2626
* [#6577](https://github.com/sebastianbergmann/phpunit/issues/6577): `--run-test-id <test-id>` CLI option that accepts a single test ID for exact matching
2727
* [#6579](https://github.com/sebastianbergmann/phpunit/pull/6579): Properly handle issues triggered outside of tests
28+
* [#6597](https://github.com/sebastianbergmann/phpunit/pull/6597): Compact output (activated through `--compact` CLI option and `PHPUNIT_COMPACT_OUTPUT=1` environment variable)
2829
* The `executionOrder` attribute in the XML configuration file now accepts `defects` combined with any main order, as well as three-way combinations of `depends`/`no-depends`, `defects`, and a main order (for example, `depends,defects,duration-ascending`)
2930
* `--validate-configuration` CLI option to validate an XML configuration file for PHPUnit
3031

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<directory suffix=".phpt">tests/end-to-end/check-php-configuration</directory>
2121
<directory suffix=".phpt">tests/end-to-end/cli</directory>
2222
<directory suffix=".phpt">tests/end-to-end/code-coverage</directory>
23+
<directory suffix=".phpt">tests/end-to-end/compact</directory>
2324
<directory suffix=".phpt">tests/end-to-end/data-provider</directory>
2425
<directory suffix=".phpt">tests/end-to-end/error-handler</directory>
2526
<directory suffix=".phpt">tests/end-to-end/event</directory>

src/TextUI/Configuration/Cli/Builder.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ final class Builder
153153
'require-coverage-contribution',
154154
'disable-coverage-ignore',
155155
'strict-global-state',
156+
'compact',
156157
'teamcity',
157158
'testdox',
158159
'testdox-summary',
@@ -193,10 +194,15 @@ final class Builder
193194
['--random-order', '--reverse-order'],
194195
['--generate-baseline', '--ignore-baseline'],
195196
['--generate-baseline', '--use-baseline'],
197+
['--no-output', '--compact'],
196198
['--no-output', '--teamcity'],
197199
['--no-output', '--testdox'],
198200
['--no-output', '--testdox-summary'],
199201
['--no-output', '--debug'],
202+
['--compact', '--teamcity'],
203+
['--compact', '--testdox'],
204+
['--compact', '--testdox-summary'],
205+
['--compact', '--debug'],
200206
];
201207

202208
/**
@@ -372,6 +378,7 @@ public function fromParameters(array $parameters): Configuration
372378
$version = false;
373379
$logEventsText = null;
374380
$logEventsVerboseText = null;
381+
$printerCompact = null;
375382
$printerTeamCity = null;
376383
$printerTestDox = null;
377384
$printerTestDoxSummary = null;
@@ -969,6 +976,11 @@ public function fromParameters(array $parameters): Configuration
969976

970977
break;
971978

979+
case '--compact':
980+
$printerCompact = true;
981+
982+
break;
983+
972984
case '--teamcity':
973985
$printerTeamCity = true;
974986

@@ -1387,6 +1399,7 @@ public function fromParameters(array $parameters): Configuration
13871399
$coverageFilter,
13881400
$logEventsText,
13891401
$logEventsVerboseText,
1402+
$printerCompact,
13901403
$printerTeamCity,
13911404
$printerTestDox,
13921405
$printerTestDoxSummary,

src/TextUI/Configuration/Cli/Configuration.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
private ?bool $strictCoverage;
163163
private ?bool $requireCoverageContribution;
164164
private ?string $teamcityLogfile;
165+
private ?bool $compactPrinter;
165166
private ?bool $teamCityPrinter;
166167
private ?string $testdoxHtmlFile;
167168
private ?string $testdoxTextFile;
@@ -208,7 +209,7 @@
208209
* @param ?non-empty-list<non-empty-string> $coverageFilter
209210
* @param ?non-empty-list<non-empty-string> $extensions
210211
*/
211-
public function __construct(array $arguments, ?string $testFilesFile, ?string $testIdFile, ?string $testIdFilter, ?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, ?int $diffContext, ?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, bool $validateConfiguration, ?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 $listTestIds, 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, ?bool $requireCoverageContribution, ?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)
212+
public function __construct(array $arguments, ?string $testFilesFile, ?string $testIdFile, ?string $testIdFilter, ?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, ?int $diffContext, ?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, bool $validateConfiguration, ?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 $listTestIds, 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, ?bool $requireCoverageContribution, ?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 $printerCompact, ?bool $printerTeamCity, ?bool $testdoxPrinter, ?bool $testdoxPrinterSummary, bool $debug, bool $withTelemetry, ?array $extensions)
212213
{
213214
$this->arguments = $arguments;
214215
$this->testFilesFile = $testFilesFile;
@@ -337,6 +338,7 @@ public function __construct(array $arguments, ?string $testFilesFile, ?string $t
337338
$this->version = $version;
338339
$this->logEventsText = $logEventsText;
339340
$this->logEventsVerboseText = $logEventsVerboseText;
341+
$this->compactPrinter = $printerCompact;
340342
$this->teamCityPrinter = $printerTeamCity;
341343
$this->testdoxPrinter = $testdoxPrinter;
342344
$this->testdoxPrinterSummary = $testdoxPrinterSummary;
@@ -2334,6 +2336,26 @@ public function teamcityLogfile(): string
23342336
return $this->teamcityLogfile;
23352337
}
23362338

2339+
/**
2340+
* @phpstan-assert-if-true !null $this->compactPrinter
2341+
*/
2342+
public function hasCompactPrinter(): bool
2343+
{
2344+
return $this->compactPrinter !== null;
2345+
}
2346+
2347+
/**
2348+
* @throws Exception
2349+
*/
2350+
public function compactPrinter(): bool
2351+
{
2352+
if (!$this->hasCompactPrinter()) {
2353+
throw new Exception;
2354+
}
2355+
2356+
return $this->compactPrinter;
2357+
}
2358+
23372359
/**
23382360
* @phpstan-assert-if-true !null $this->teamCityPrinter
23392361
*/

0 commit comments

Comments
 (0)