diff --git a/Application.php b/Application.php index 99548faf8..d4ec1be09 100644 --- a/Application.php +++ b/Application.php @@ -298,6 +298,8 @@ public function doRun(InputInterface $input, OutputInterface $output) return isset($event) ? $event->getExitCode() : 1; } + + throw $e; } catch (NamespaceNotFoundException) { throw $e; } diff --git a/Tests/ApplicationTest.php b/Tests/ApplicationTest.php index c17815168..c82c3eb18 100644 --- a/Tests/ApplicationTest.php +++ b/Tests/ApplicationTest.php @@ -18,6 +18,7 @@ use Symfony\Component\Console\Command\HelpCommand; use Symfony\Component\Console\Command\LazyCommand; use Symfony\Component\Console\Command\SignalableCommandInterface; +use Symfony\Component\Console\CommandLoader\CommandLoaderInterface; use Symfony\Component\Console\CommandLoader\FactoryCommandLoader; use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass; use Symfony\Component\Console\Event\ConsoleCommandEvent; @@ -1466,6 +1467,25 @@ public function testRunWithError() } } + public function testRunWithFindError() + { + $this->expectException(\Error::class); + $this->expectExceptionMessage('Find exception'); + + $application = new Application(); + $application->setAutoExit(false); + $application->setCatchExceptions(false); + + // Throws an exception when find fails + $commandLoader = $this->createMock(CommandLoaderInterface::class); + $commandLoader->method('getNames')->willThrowException(new \Error('Find exception')); + $application->setCommandLoader($commandLoader); + + // The exception should not be ignored + $tester = new ApplicationTester($application); + $tester->run(['command' => 'foo']); + } + public function testRunAllowsErrorListenersToSilenceTheException() { $dispatcher = $this->getDispatcher(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy