Skip to content

Commit a0bdfc5

Browse files
Merge branch '11.5' into 12.0
2 parents bfe1f00 + ffd57af commit a0bdfc5

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

ChangeLog-12.0.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 12.0 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [12.0.5] - 2025-MM-DD
6+
7+
### Fixed
8+
9+
* [#6138](https://github.com/sebastianbergmann/phpunit/issues/6138): Test with failed expectation on value passed to mocked method is incorrectly considered risky
10+
511
## [12.0.4] - 2025-02-21
612

713
### Fixed
@@ -80,6 +86,7 @@ All notable changes of the PHPUnit 12.0 release series are documented in this fi
8086
* [#5801](https://github.com/sebastianbergmann/phpunit/issues/5801): Support for targeting traits with `#[CoversClass]` and `#[UsesClass]` attributes
8187
* [#5978](https://github.com/sebastianbergmann/phpunit/issues/5978): Support for PHP 8.2
8288

89+
[12.0.5]: https://github.com/sebastianbergmann/phpunit/compare/12.0.4...12.0
8390
[12.0.4]: https://github.com/sebastianbergmann/phpunit/compare/12.0.3...12.0.4
8491
[12.0.3]: https://github.com/sebastianbergmann/phpunit/compare/12.0.2...12.0.3
8592
[12.0.2]: https://github.com/sebastianbergmann/phpunit/compare/12.0.1...12.0.2

src/Framework/MockObject/Runtime/Rule/Parameters.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class Parameters implements ParametersRule
4141
public function __construct(array $parameters)
4242
{
4343
foreach ($parameters as $parameter) {
44-
if (!($parameter instanceof Constraint)) {
44+
if (!$parameter instanceof Constraint) {
4545
$parameter = new IsEqual(
4646
$parameter,
4747
);
@@ -116,6 +116,7 @@ private function doVerify(): bool
116116
} else {
117117
$other = $this->invocation->parameters()[$i];
118118
}
119+
119120
$parameter->evaluate(
120121
$other,
121122
sprintf(

src/Framework/TestRunner/TestRunner.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ public function run(TestCase $test): void
177177

178178
ErrorHandler::instance()->disable();
179179

180+
/**
181+
* Workaround for tests that fail due to mock object expectations
182+
* that are verified while the test is running and not after the
183+
* test has finished running
184+
*
185+
* @see https://github.com/sebastianbergmann/phpunit/issues/6138
186+
*/
187+
if ($failure &&
188+
!$error &&
189+
!$incomplete &&
190+
!$skipped &&
191+
$test->numberOfAssertionsPerformed() === 0) {
192+
$test->addToAssertionCount(1);
193+
}
194+
180195
if (!$error &&
181196
!$incomplete &&
182197
!$skipped &&

tests/end-to-end/regression/6138.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
https://github.com/sebastianbergmann/phpunit/issues/6138
3-
--XFAIL--
4-
https://github.com/sebastianbergmann/phpunit/issues/6138
53
--FILE--
64
<?php declare(strict_types=1);
75
$_SERVER['argv'][] = '--do-not-cache-result';

0 commit comments

Comments
 (0)