From 75c7cf5ff2ebad12d374bc435a944190d2e877fb Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Tue, 18 Jun 2024 13:35:11 +0200 Subject: [PATCH] Change default value for shortenArraysForExportThreshold to 0 (therefore disabling the limiting of array exports) --- phpunit.xsd | 2 +- src/TextUI/Configuration/Configuration.php | 6 +++--- src/TextUI/Configuration/Xml/DefaultConfiguration.php | 2 +- src/TextUI/Configuration/Xml/Loader.php | 6 +++--- src/TextUI/Configuration/Xml/PHPUnit.php | 6 +++--- tests/_files/configuration.xml | 2 +- tests/unit/TextUI/Configuration/Xml/LoaderTest.php | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/phpunit.xsd b/phpunit.xsd index 1418619eaa..d5f95bfd28 100644 --- a/phpunit.xsd +++ b/phpunit.xsd @@ -218,7 +218,7 @@ - + diff --git a/src/TextUI/Configuration/Configuration.php b/src/TextUI/Configuration/Configuration.php index f4a61e632f..4706729bcc 100644 --- a/src/TextUI/Configuration/Configuration.php +++ b/src/TextUI/Configuration/Configuration.php @@ -141,7 +141,7 @@ private bool $debug; /** - * @psalm-var positive-int + * @psalm-var non-negative-int */ private int $shortenArraysForExportThreshold; @@ -150,7 +150,7 @@ * @psalm-param ?non-empty-string $pharExtensionDirectory * @psalm-param non-empty-list $testSuffixes * @psalm-param list}> $extensionBootstrappers - * @psalm-param positive-int $shortenArraysForExportThreshold + * @psalm-param non-negative-int $shortenArraysForExportThreshold */ 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, int $shortenArraysForExportThreshold) { @@ -1215,7 +1215,7 @@ public function debug(): bool } /** - * @psalm-return positive-int + * @psalm-return non-negative-int */ public function shortenArraysForExportThreshold(): int { diff --git a/src/TextUI/Configuration/Xml/DefaultConfiguration.php b/src/TextUI/Configuration/Xml/DefaultConfiguration.php index 156a03917b..2fc80fe0c0 100644 --- a/src/TextUI/Configuration/Xml/DefaultConfiguration.php +++ b/src/TextUI/Configuration/Xml/DefaultConfiguration.php @@ -147,7 +147,7 @@ public static function create(): self false, false, 100, - 10, + 0, ), TestSuiteCollection::fromArray([]), ); diff --git a/src/TextUI/Configuration/Xml/Loader.php b/src/TextUI/Configuration/Xml/Loader.php index 7d20d6a746..618a788d03 100644 --- a/src/TextUI/Configuration/Xml/Loader.php +++ b/src/TextUI/Configuration/Xml/Loader.php @@ -809,10 +809,10 @@ private function phpunit(string $filename, DOMDocument $document): PHPUnit $beStrictAboutCoverageMetadata = $this->getBooleanAttribute($document->documentElement, 'beStrictAboutCoverageMetadata', false); } - $shortenArraysForExportThreshold = $this->getIntegerAttribute($document->documentElement, 'shortenArraysForExportThreshold', 10); + $shortenArraysForExportThreshold = $this->getIntegerAttribute($document->documentElement, 'shortenArraysForExportThreshold', 0); - if ($shortenArraysForExportThreshold < 1) { - $shortenArraysForExportThreshold = 10; + if ($shortenArraysForExportThreshold < 0) { + $shortenArraysForExportThreshold = 0; } return new PHPUnit( diff --git a/src/TextUI/Configuration/Xml/PHPUnit.php b/src/TextUI/Configuration/Xml/PHPUnit.php index 9f4c5e44e8..a620fe63b6 100644 --- a/src/TextUI/Configuration/Xml/PHPUnit.php +++ b/src/TextUI/Configuration/Xml/PHPUnit.php @@ -72,13 +72,13 @@ private int $numberOfTestsBeforeGarbageCollection; /** - * @psalm-var positive-int + * @psalm-var non-negative-int */ private int $shortenArraysForExportThreshold; /** * @psalm-param ?non-empty-string $extensionsDirectory - * @psalm-param positive-int $shortenArraysForExportThreshold + * @psalm-param non-negative-int $shortenArraysForExportThreshold */ public function __construct(?string $cacheDirectory, bool $cacheResult, int|string $columns, string $colors, bool $stderr, bool $displayDetailsOnIncompleteTests, bool $displayDetailsOnSkippedTests, bool $displayDetailsOnTestsThatTriggerDeprecations, bool $displayDetailsOnTestsThatTriggerErrors, bool $displayDetailsOnTestsThatTriggerNotices, bool $displayDetailsOnTestsThatTriggerWarnings, bool $reverseDefectList, bool $requireCoverageMetadata, ?string $bootstrap, bool $processIsolation, 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 $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 $controlGarbageCollector, int $numberOfTestsBeforeGarbageCollection, int $shortenArraysForExportThreshold) { @@ -448,7 +448,7 @@ public function numberOfTestsBeforeGarbageCollection(): int } /** - * @psalm-return positive-int + * @psalm-return non-negative-int */ public function shortenArraysForExportThreshold(): int { diff --git a/tests/_files/configuration.xml b/tests/_files/configuration.xml index 45c37da1c7..f29010b7b0 100644 --- a/tests/_files/configuration.xml +++ b/tests/_files/configuration.xml @@ -31,7 +31,7 @@ executionOrder="default" controlGarbageCollector="true" numberOfTestsBeforeGarbageCollection="1000" - shortenArraysForExportThreshold="100" + shortenArraysForExportThreshold="10" > diff --git a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php index 7c8e483bc6..cfde5fa99d 100644 --- a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php +++ b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php @@ -357,7 +357,7 @@ public function testPHPUnitConfigurationIsReadCorrectly(): void $this->assertTrue($phpunit->resolveDependencies()); $this->assertTrue($phpunit->controlGarbageCollector()); $this->assertSame(1000, $phpunit->numberOfTestsBeforeGarbageCollection()); - $this->assertSame(100, $phpunit->shortenArraysForExportThreshold()); + $this->assertSame(10, $phpunit->shortenArraysForExportThreshold()); } public function test_TestDox_configuration_is_parsed_correctly(): void