Skip to content

Commit 0ccac7f

Browse files
Closes #4913
1 parent e8c563c commit 0ccac7f

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

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

5+
## [8.5.30] - 2022-MM-DD
6+
7+
### Fixed
8+
9+
* [#4913](https://github.com/sebastianbergmann/phpunit/issues/4913): Failed `assert()` should show a backtrace
10+
511
## [8.5.29] - 2022-08-22
612

713
### Changed
@@ -239,6 +245,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
239245
* [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
240246
* [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
241247

248+
[8.5.30]: https://github.com/sebastianbergmann/phpunit/compare/8.5.29...8.5
242249
[8.5.29]: https://github.com/sebastianbergmann/phpunit/compare/8.5.28...8.5.29
243250
[8.5.28]: https://github.com/sebastianbergmann/phpunit/compare/8.5.27...8.5.28
244251
[8.5.27]: https://github.com/sebastianbergmann/phpunit/compare/8.5.26...8.5.27

src/Framework/TestResult.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,9 @@ function_exists('xdebug_start_function_monitor');
740740
$e->getMessage(),
741741
$frame['file'] ?? $e->getFile(),
742742
$frame['line'] ?? $e->getLine()
743-
)
743+
),
744+
0,
745+
$e
744746
);
745747
} catch (Warning $e) {
746748
$warning = true;

src/TextUI/ResultPrinter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use function str_pad;
2424
use function str_repeat;
2525
use function strlen;
26+
use function trim;
2627
use function vsprintf;
2728
use PHPUnit\Framework\AssertionFailedError;
2829
use PHPUnit\Framework\Exception;
@@ -367,7 +368,7 @@ protected function printDefectTrace(TestFailure $defect): void
367368
$this->write((string) $e);
368369

369370
while ($e = $e->getPrevious()) {
370-
$this->write("\nCaused by\n" . $e);
371+
$this->write("\nCaused by\n" . trim((string) $e) . "\n");
371372
}
372373
}
373374

tests/end-to-end/generic/assertion.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ There was 1 failure:
2929
1) PHPUnit\TestFixture\AssertionExampleTest::testOne
3030
assert(false) in %sAssertionExample.php:%d
3131

32+
Caused by
33+
AssertionError: assert(false) in %sAssertionExample.php:%d
34+
Stack trace:
35+
%A
36+
3237
FAILURES!
3338
Tests: 1, Assertions: 1, Failures: 1.

0 commit comments

Comments
 (0)