1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

Do not catch exceptions when testing Console commands (#3813)

* Do not catch exceptions when testing Console commands

This allows to easily test a case where a command should throw using `$this->expectException()`.

* Rewrite ConsoleTest to use expectException

Now that the ConsoleApplication is set to not catch exceptions.

---------

Co-authored-by: IanM <16573496+imorland@users.noreply.github.com>
This commit is contained in:
Nicolas Peugnet
2023-06-21 09:14:12 +02:00
committed by GitHub
parent 7799c2fcd5
commit 4a966b830f
2 changed files with 4 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ abstract class ConsoleTestCase extends TestCase
if (is_null($this->console)) {
$this->console = new ConsoleApplication('Flarum', Application::VERSION);
$this->console->setAutoExit(false);
$this->console->setCatchExceptions(false);
foreach ($this->app()->getConsoleCommands() as $command) {
$this->console->add($command);