diff --git a/composer.json b/composer.json index 3e1d786e020..1d073b8b3e9 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,12 @@ "security": "https://github.com/sebastianbergmann/phpunit/security/policy" }, "prefer-stable": true, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/gammamatrix/php-code-coverage.git" + } + ], "require": { "php": ">=8.2", "ext-dom": "*", @@ -32,7 +38,7 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "phpunit/php-code-coverage": "^11.0", + "phpunit/php-code-coverage": "dev-update-to-bootstrap-5", "phpunit/php-file-iterator": "^5.0", "phpunit/php-invoker": "^5.0", "phpunit/php-text-template": "^4.0", diff --git a/composer.lock b/composer.lock index ec8edf3449a..62d0c783706 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3871b6355e38b9f01fc1f1190e544f32", + "content-hash": "9f98bd79ddefacac3829b1eaee2ed49c", "packages": [ { "name": "myclabs/deep-copy", @@ -243,16 +243,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.3", + "version": "dev-update-to-bootstrap-5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "7e35a2cbcabac0e6865fd373742ea432a3c34f92" + "url": "https://github.com/gammamatrix/php-code-coverage.git", + "reference": "ba3047f872113a15df70f8e5d246b0524681f98c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e35a2cbcabac0e6865fd373742ea432a3c34f92", - "reference": "7e35a2cbcabac0e6865fd373742ea432a3c34f92", + "url": "https://api.github.com/repos/gammamatrix/php-code-coverage/zipball/ba3047f872113a15df70f8e5d246b0524681f98c", + "reference": "ba3047f872113a15df70f8e5d246b0524681f98c", "shasum": "" }, "require": { @@ -288,7 +288,12 @@ "src/" ] }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "files": [ + "tests/TestCase.php", + "tests/_files/BankAccountTest.php" + ] + }, "license": [ "BSD-3-Clause" ], @@ -309,15 +314,15 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.3" + "source": "https://github.com/gammamatrix/php-code-coverage/tree/update-to-bootstrap-5" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", - "type": "github" + "type": "github", + "url": "https://github.com/sebastianbergmann" } ], - "time": "2024-03-12T15:35:40+00:00" + "time": "2024-05-08T03:33:59+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1541,7 +1546,9 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "phpunit/php-code-coverage": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/phpunit.xsd b/phpunit.xsd index c3b23dbf45a..8afc272dc44 100644 --- a/phpunit.xsd +++ b/phpunit.xsd @@ -316,6 +316,7 @@ + diff --git a/src/Runner/CodeCoverage.php b/src/Runner/CodeCoverage.php index b762f9bd604..3d1b3b02c3f 100644 --- a/src/Runner/CodeCoverage.php +++ b/src/Runner/CodeCoverage.php @@ -282,6 +282,7 @@ public function generateReports(Printer $printer, Configuration $configuration): $configuration->coverageHtmlColorSuccessHigh(), $configuration->coverageHtmlColorWarning(), $configuration->coverageHtmlColorDanger(), + $configuration->coverageHtmlTheme(), ), Thresholds::from( $configuration->coverageHtmlLowUpperBound(), diff --git a/src/TextUI/Configuration/Configuration.php b/src/TextUI/Configuration/Configuration.php index 903cfebaab3..07bbf19db30 100644 --- a/src/TextUI/Configuration/Configuration.php +++ b/src/TextUI/Configuration/Configuration.php @@ -45,6 +45,7 @@ private string $coverageHtmlColorWarning; private string $coverageHtmlColorDanger; private ?string $coverageHtmlCustomCssFile; + private string $coverageHtmlTheme; private ?string $coveragePhp; private ?string $coverageText; private bool $coverageTextShowUncoveredFiles; @@ -146,7 +147,7 @@ * @psalm-param non-empty-list $testSuffixes * @psalm-param list}> $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, bool $debug) + 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 $coverageHtmlTheme, ?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; @@ -169,6 +170,7 @@ public function __construct(array $cliArguments, ?string $configurationFile, ?st $this->coverageHtmlColorWarning = $coverageHtmlColorWarning; $this->coverageHtmlColorDanger = $coverageHtmlColorDanger; $this->coverageHtmlCustomCssFile = $coverageHtmlCustomCssFile; + $this->coverageHtmlTheme = $coverageHtmlTheme; $this->coveragePhp = $coveragePhp; $this->coverageText = $coverageText; $this->coverageTextShowUncoveredFiles = $coverageTextShowUncoveredFiles; @@ -510,6 +512,11 @@ public function coverageHtmlColorDanger(): string return $this->coverageHtmlColorDanger; } + public function coverageHtmlTheme(): string + { + return $this->coverageHtmlTheme; + } + /** * @psalm-assert-if-true !null $this->coverageHtmlCustomCssFile */ diff --git a/src/TextUI/Configuration/Merger.php b/src/TextUI/Configuration/Merger.php index 820f894b32d..1eb799fd297 100644 --- a/src/TextUI/Configuration/Merger.php +++ b/src/TextUI/Configuration/Merger.php @@ -263,6 +263,7 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC $coverageHtmlColorWarning = $defaultColors->warning(); $coverageHtmlColorDanger = $defaultColors->danger(); $coverageHtmlCustomCssFile = null; + $coverageHtmlTheme = $defaultColors->theme(); $coveragePhp = null; $coverageText = null; $coverageTextShowUncoveredFiles = false; @@ -310,6 +311,7 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC $coverageHtmlColorSuccessHigh = $xmlConfiguration->codeCoverage()->html()->colorSuccessHigh(); $coverageHtmlColorWarning = $xmlConfiguration->codeCoverage()->html()->colorWarning(); $coverageHtmlColorDanger = $xmlConfiguration->codeCoverage()->html()->colorDanger(); + $coverageHtmlTheme = $xmlConfiguration->codeCoverage()->html()->theme(); if ($xmlConfiguration->codeCoverage()->html()->hasCustomCssFile()) { $coverageHtmlCustomCssFile = $xmlConfiguration->codeCoverage()->html()->customCssFile(); @@ -750,6 +752,7 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC $coverageHtmlColorWarning, $coverageHtmlColorDanger, $coverageHtmlCustomCssFile, + $coverageHtmlTheme, $coveragePhp, $coverageText, $coverageTextShowUncoveredFiles, diff --git a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php index 91605b8fa81..46b9719e44f 100644 --- a/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php +++ b/src/TextUI/Configuration/Xml/CodeCoverage/Report/Html.php @@ -28,8 +28,9 @@ private string $colorWarning; private string $colorDanger; private ?string $customCssFile; + private string $theme; - public function __construct(Directory $target, int $lowUpperBound, int $highLowerBound, string $colorSuccessLow, string $colorSuccessMedium, string $colorSuccessHigh, string $colorWarning, string $colorDanger, ?string $customCssFile) + public function __construct(Directory $target, int $lowUpperBound, int $highLowerBound, string $colorSuccessLow, string $colorSuccessMedium, string $colorSuccessHigh, string $colorWarning, string $colorDanger, ?string $customCssFile, string $theme = '') { $this->target = $target; $this->lowUpperBound = $lowUpperBound; @@ -40,6 +41,7 @@ public function __construct(Directory $target, int $lowUpperBound, int $highLowe $this->colorWarning = $colorWarning; $this->colorDanger = $colorDanger; $this->customCssFile = $customCssFile; + $this->theme = $theme; } public function target(): Directory @@ -82,6 +84,11 @@ public function colorDanger(): string return $this->colorDanger; } + public function theme(): string + { + return $this->theme; + } + /** * @psalm-assert-if-true !null $this->customCssFile */ diff --git a/src/TextUI/Configuration/Xml/Loader.php b/src/TextUI/Configuration/Xml/Loader.php index b98b5956397..0c121045fd7 100644 --- a/src/TextUI/Configuration/Xml/Loader.php +++ b/src/TextUI/Configuration/Xml/Loader.php @@ -428,6 +428,7 @@ private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage $this->getStringAttributeWithDefault($element, 'colorWarning', $defaultColors->warning()), $this->getStringAttributeWithDefault($element, 'colorDanger', $defaultColors->danger()), $this->getStringAttribute($element, 'customCssFile'), + $this->getStringAttributeWithDefault($element, 'theme', $defaultColors->theme()), ); } diff --git a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php index 58f824fe9d0..e472a9bf940 100644 --- a/tests/unit/TextUI/Configuration/Xml/LoaderTest.php +++ b/tests/unit/TextUI/Configuration/Xml/LoaderTest.php @@ -211,6 +211,7 @@ public function testCodeCoverageConfigurationIsReadCorrectly(): void $this->assertSame($defaultColors->successHigh(), $codeCoverage->html()->colorSuccessHigh()); $this->assertSame($defaultColors->warning(), $codeCoverage->html()->colorWarning()); $this->assertSame($defaultColors->danger(), $codeCoverage->html()->colorDanger()); + $this->assertSame($defaultColors->theme(), $codeCoverage->html()->theme()); $this->assertFalse($codeCoverage->html()->hasCustomCssFile()); $this->assertTrue($codeCoverage->hasPhp());