Skip to content

Commit 2757834

Browse files
Merge branch '11.5' into 12.3
2 parents 9b15def + 321b0ba commit 2757834

File tree

4 files changed

+71
-1
lines changed

4 files changed

+71
-1
lines changed

ChangeLog-12.3.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes of the PHPUnit 12.3 release series are documented in this fi
77
### Fixed
88

99
* [#6279](https://github.com/sebastianbergmann/phpunit/issues/6279): Deprecation triggered in data provider method affects all test methods using that data provider method
10+
* [#6281](https://github.com/sebastianbergmann/phpunit/issues/6281): Exceptions raised in after-test method are not reported for skipped tests
1011

1112
## [12.3.3] - 2025-08-11
1213

src/Framework/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ final public function runBare(): void
619619
Event\Code\ComparisonFailureBuilder::from($e),
620620
);
621621
} catch (Throwable $exceptionRaisedDuringTearDown) {
622-
if (!isset($e)) {
622+
if (!isset($e) || $e instanceof SkippedWithMessageException) {
623623
$this->status = TestStatus::error($exceptionRaisedDuringTearDown->getMessage());
624624
$e = $exceptionRaisedDuringTearDown;
625625

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/6281
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--debug';
8+
$_SERVER['argv'][] = __DIR__ . '/6281/Issue6281Test.php';
9+
10+
require_once __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit Started (PHPUnit %s using %s)
15+
Test Runner Configured
16+
Event Facade Sealed
17+
Test Suite Loaded (1 test)
18+
Test Runner Started
19+
Test Suite Sorted
20+
Test Runner Execution Started (1 test)
21+
Test Suite Started (PHPUnit\TestFixture\Issue6281\Issue6281Test, 1 test)
22+
Test Preparation Started (PHPUnit\TestFixture\Issue6281\Issue6281Test::testOne)
23+
Before Test Method Called (PHPUnit\TestFixture\Issue6281\Issue6281Test::setUp)
24+
Before Test Method Finished:
25+
- PHPUnit\TestFixture\Issue6281\Issue6281Test::setUp
26+
Test Skipped (PHPUnit\TestFixture\Issue6281\Issue6281Test::testOne)
27+
skip message
28+
After Test Method Called (PHPUnit\TestFixture\Issue6281\Issue6281Test::tearDown)
29+
After Test Method Errored (PHPUnit\TestFixture\Issue6281\Issue6281Test::tearDown)
30+
exception message
31+
After Test Method Finished:
32+
- PHPUnit\TestFixture\Issue6281\Issue6281Test::tearDown
33+
Test Errored (PHPUnit\TestFixture\Issue6281\Issue6281Test::testOne)
34+
exception message
35+
Test Suite Finished (PHPUnit\TestFixture\Issue6281\Issue6281Test, 1 test)
36+
Test Runner Execution Finished
37+
Test Runner Finished
38+
PHPUnit Finished (Shell Exit Code: 2)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\Issue6281;
11+
12+
use Exception;
13+
use PHPUnit\Framework\TestCase;
14+
15+
final class Issue6281Test extends TestCase
16+
{
17+
protected function setUp(): void
18+
{
19+
$this->markTestSkipped('skip message');
20+
}
21+
22+
protected function tearDown(): void
23+
{
24+
throw new Exception('exception message');
25+
}
26+
27+
public function testOne(): void
28+
{
29+
$this->assertTrue(true);
30+
}
31+
}

0 commit comments

Comments
 (0)