File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed
Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change 1515use Guanguans \LaravelExceptionNotify \ExceptionNotifyManager ;
1616use Guanguans \LaravelExceptionNotify \Exceptions \RuntimeException ;
1717use Illuminate \Console \Command ;
18+ use Illuminate \Console \OutputStyle ;
1819use Illuminate \Support \Arr ;
20+ use Symfony \Component \Console \Input \ArgvInput ;
21+ use Symfony \Component \Console \Output \ConsoleOutput ;
1922
2023class TestCommand extends Command
2124{
@@ -27,6 +30,10 @@ class TestCommand extends Command
2730
2831 public function __destruct ()
2932 {
33+ if (! $ this ->output instanceof OutputStyle) {
34+ $ this ->output = new OutputStyle (new ArgvInput , new ConsoleOutput );
35+ }
36+
3037 if ($ this ->error ) {
3138 $ this ->output ->error ($ this ->error );
3239
Original file line number Diff line number Diff line change 1212
1313use Guanguans \LaravelExceptionNotify \Commands \TestCommand ;
1414use Symfony \Component \Console \Command \Command ;
15- use Symfony \Component \Console \Input \ArgvInput ;
16- use Symfony \Component \Console \Output \ConsoleOutput ;
17- use Symfony \Component \Console \Style \SymfonyStyle ;
1815
1916use function Pest \Laravel \artisan ;
2017
21- beforeEach (function (): void {
22- $ this ->app ->extend (TestCommand::class, function (TestCommand $ testCommand ) {
23- if (! $ testCommand ->getOutput ()) {
24- (function (): void {
25- $ this ->output = new SymfonyStyle (new ArgvInput , new ConsoleOutput );
26- })->call ($ testCommand );
27- }
28-
29- return $ testCommand ;
30- });
31- });
32-
3318it ('can test for exception-notify ' , function (): void {
3419 config ()->set ('exception-notify.enabled ' , false );
3520 artisan (TestCommand::class)->assertExitCode (Command::SUCCESS );
You can’t perform that action at this time.
0 commit comments