Skip to content

Commit

Permalink
Merge branch '9.6' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed May 9, 2023
2 parents d45b99c + 71b53ae commit b54dec3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ChangeLog-10.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ All notable changes of the PHPUnit 10.1 release series are documented in this fi

* [#5343](https://github.com/sebastianbergmann/phpunit/pull/5343): Provide distinct messages when a test is considered risky due to output buffering level mismatch

### Fixed

* [#5345](https://github.com/sebastianbergmann/phpunit/issues/5345): No stack trace shown for previous exceptions during bootstrap

## [10.1.2] - 2023-04-22

### Added
Expand Down
25 changes: 19 additions & 6 deletions src/TextUI/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,29 @@ private function loadBootstrapScript(string $filename): void
try {
include_once $filename;
} catch (Throwable $t) {
$this->exitWithErrorMessage(
sprintf(
'Error in bootstrap script: %s:%s%s%s%s',
$message = sprintf(
'Error in bootstrap script: %s:%s%s%s%s',
$t::class,
PHP_EOL,
$t->getMessage(),
PHP_EOL,
$t->getTraceAsString()
);

while ($t = $t->getPrevious()) {
$message .= sprintf(
'%s%sPrevious error: %s:%s%s%s%s',
PHP_EOL,
PHP_EOL,
$t::class,
PHP_EOL,
$t->getMessage(),
PHP_EOL,
$t->getTraceAsString()
)
);
$t->getTraceAsString(),
);
}

$this->exitWithErrorMessage($message);
}

EventFacade::emitter()->testRunnerBootstrapFinished($filename);
Expand Down
4 changes: 4 additions & 0 deletions tests/end-to-end/regression/4620.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.
Error in bootstrap script: PHPUnit\TestFixture\MyException:
Big boom. Big bada boom.
%a

Previous error: Exception:
Previous boom.
%a
2 changes: 1 addition & 1 deletion tests/end-to-end/regression/4620/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ final class MyException extends Exception
{
}

throw new MyException('Big boom. Big bada boom.');
throw new MyException('Big boom. Big bada boom.', 0, new Exception('Previous boom.'));

0 comments on commit b54dec3

Please sign in to comment.