Skip to content

Commit 5a3b198

Browse files
Closes #6340
1 parent d189927 commit 5a3b198

File tree

4 files changed

+70
-6
lines changed

4 files changed

+70
-6
lines changed

ChangeLog-11.5.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 11.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [11.5.36] - 2025-MM-DD
6+
7+
### Fixed
8+
9+
* [#6340](https://github.com/sebastianbergmann/phpunit/issues/6340): Implicitly enabled display of deprecation details is not disabled when it should be
10+
511
## [11.5.35] - 2025-08-28
612

713
### Changed
@@ -320,6 +326,7 @@ All notable changes of the PHPUnit 11.5 release series are documented in this fi
320326
* [#6055](https://github.com/sebastianbergmann/phpunit/issues/6055): `assertNotContainsOnly()` (use `assertContainsNotOnlyArray()`, `assertContainsNotOnlyBool()`, `assertContainsNotOnlyCallable()`, `assertContainsNotOnlyFloat()`, `assertContainsNotOnlyInt()`, `assertContainsNotOnlyIterable()`, `assertContainsNotOnlyNumeric()`, `assertContainsNotOnlyObject()`, `assertContainsNotOnlyResource()`, `assertContainsNotOnlyClosedResource()`, `assertContainsNotOnlyScalar()`, or `assertContainsNotOnlyString()` instead)
321327
* [#6059](https://github.com/sebastianbergmann/phpunit/issues/6059): `containsOnly()` (use `containsOnlyArray()`, `containsOnlyBool()`, `containsOnlyCallable()`, `containsOnlyFloat()`, `containsOnlyInt()`, `containsOnlyIterable()`, `containsOnlyNumeric()`, `containsOnlyObject()`, `containsOnlyResource()`, `containsOnlyClosedResource()`, `containsOnlyScalar()`, or `containsOnlyString()` instead)
322328

329+
[11.5.36]: https://github.com/sebastianbergmann/phpunit/compare/11.5.35...11.5
323330
[11.5.35]: https://github.com/sebastianbergmann/phpunit/compare/11.5.34...11.5.35
324331
[11.5.34]: https://github.com/sebastianbergmann/phpunit/compare/11.5.33...11.5.34
325332
[11.5.33]: https://github.com/sebastianbergmann/phpunit/compare/11.5.32...11.5.33

src/TextUI/Configuration/Merger.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -825,27 +825,27 @@ public function merge(CliConfiguration $cliConfiguration, XmlConfiguration $xmlC
825825
$displayDetailsOnAllIssues = true;
826826
}
827827

828-
if ($failOnDeprecation) {
828+
if ($failOnDeprecation && !$doNotFailOnDeprecation) {
829829
$displayDetailsOnTestsThatTriggerDeprecations = true;
830830
}
831831

832-
if ($failOnPhpunitDeprecation) {
832+
if ($failOnPhpunitDeprecation && !$doNotFailOnPhpunitDeprecation) {
833833
$displayDetailsOnPhpunitDeprecations = true;
834834
}
835835

836-
if ($failOnNotice) {
836+
if ($failOnNotice && !$doNotFailOnNotice) {
837837
$displayDetailsOnTestsThatTriggerNotices = true;
838838
}
839839

840-
if ($failOnWarning) {
840+
if ($failOnWarning && !$doNotFailOnWarning) {
841841
$displayDetailsOnTestsThatTriggerWarnings = true;
842842
}
843843

844-
if ($failOnIncomplete) {
844+
if ($failOnIncomplete && !$doNotFailOnIncomplete) {
845845
$displayDetailsOnIncompleteTests = true;
846846
}
847847

848-
if ($failOnSkipped) {
848+
if ($failOnSkipped && !$doNotFailOnSkipped) {
849849
$displayDetailsOnSkippedTests = true;
850850
}
851851

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../phpunit.xsd"
4+
failOnPhpunitDeprecation="true"
5+
failOnDeprecation="true"
6+
failOnNotice="true"
7+
failOnWarning="true"
8+
failOnIncomplete="true"
9+
failOnSkipped="true"
10+
>
11+
</phpunit>

tests/unit/TextUI/Configuration/MergerTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use function uniqid;
1313
use PHPUnit\Framework\Attributes\CoversClass;
1414
use PHPUnit\Framework\Attributes\Medium;
15+
use PHPUnit\Framework\Attributes\Ticket;
1516
use PHPUnit\Framework\TestCase;
1617
use PHPUnit\TextUI\CliArguments\Builder;
1718
use PHPUnit\TextUI\Configuration\Merger;
@@ -81,4 +82,49 @@ public function testNoCoverageShouldOnlyAffectXmlConfiguration(): void
8182
$this->assertTrue($mergedConfig->hasCoveragePhp());
8283
$this->assertSame($phpCoverage, $mergedConfig->coveragePhp());
8384
}
85+
86+
#[Ticket('https://github.com/sebastianbergmann/phpunit/issues/6340')]
87+
public function testIssue6340(): void
88+
{
89+
$fromFile = (new Loader)->load(TEST_FILES_PATH . 'configuration-issue-6340.xml');
90+
91+
$this->assertTrue($fromFile->phpunit()->failOnPhpunitDeprecation());
92+
$this->assertTrue($fromFile->phpunit()->failOnDeprecation());
93+
$this->assertTrue($fromFile->phpunit()->failOnNotice());
94+
$this->assertTrue($fromFile->phpunit()->failOnWarning());
95+
$this->assertTrue($fromFile->phpunit()->failOnIncomplete());
96+
$this->assertTrue($fromFile->phpunit()->failOnSkipped());
97+
98+
$fromCli = (new Builder)->fromParameters([
99+
'--do-not-fail-on-phpunit-deprecation',
100+
'--do-not-fail-on-deprecation',
101+
'--do-not-fail-on-notice',
102+
'--do-not-fail-on-warning',
103+
'--do-not-fail-on-incomplete',
104+
'--do-not-fail-on-skipped',
105+
]);
106+
107+
$this->assertTrue($fromCli->doNotFailOnPhpunitDeprecation());
108+
$this->assertTrue($fromCli->doNotFailOnDeprecation());
109+
$this->assertTrue($fromCli->doNotFailOnNotice());
110+
$this->assertTrue($fromCli->doNotFailOnWarning());
111+
$this->assertTrue($fromCli->doNotFailOnIncomplete());
112+
$this->assertTrue($fromCli->doNotFailOnSkipped());
113+
114+
$mergedConfig = (new Merger)->merge($fromCli, $fromFile);
115+
116+
$this->assertTrue($mergedConfig->doNotFailOnPhpunitDeprecation());
117+
$this->assertTrue($mergedConfig->doNotFailOnDeprecation());
118+
$this->assertTrue($mergedConfig->doNotFailOnNotice());
119+
$this->assertTrue($mergedConfig->doNotFailOnWarning());
120+
$this->assertTrue($mergedConfig->doNotFailOnIncomplete());
121+
$this->assertTrue($mergedConfig->doNotFailOnSkipped());
122+
123+
$this->assertFalse($mergedConfig->displayDetailsOnPhpunitDeprecations());
124+
$this->assertFalse($mergedConfig->displayDetailsOnTestsThatTriggerDeprecations());
125+
$this->assertFalse($mergedConfig->displayDetailsOnTestsThatTriggerNotices());
126+
$this->assertFalse($mergedConfig->displayDetailsOnTestsThatTriggerWarnings());
127+
$this->assertFalse($mergedConfig->displayDetailsOnIncompleteTests());
128+
$this->assertFalse($mergedConfig->displayDetailsOnSkippedTests());
129+
}
84130
}

0 commit comments

Comments
 (0)