@@ -1367,8 +1367,8 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEvent()
13671367 $ application ->setCatchExceptions (false );
13681368 $ application ->setDispatcher (new EventDispatcher ());
13691369
1370- $ application ->register ('dym ' )->setCode (function (InputInterface $ input , OutputInterface $ output ) {
1371- new \UnknownClass ( );
1370+ $ application ->register ('dym ' )->setCode (function () {
1371+ throw new \Error ( ' Something went wrong. ' );
13721372 });
13731373
13741374 $ tester = new ApplicationTester ($ application );
@@ -1377,7 +1377,7 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEvent()
13771377 $ tester ->run (['command ' => 'dym ' ]);
13781378 $ this ->fail ('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent. ' );
13791379 } catch (\Error $ e ) {
1380- $ this ->assertSame ($ e ->getMessage (), ' Class \' UnknownClass \' not found ' );
1380+ $ this ->assertSame (' Something went wrong. ' , $ e ->getMessage ());
13811381 }
13821382 }
13831383
@@ -1702,8 +1702,8 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn
17021702 $ application ->setAutoExit (false );
17031703 $ application ->setDispatcher (new EventDispatcher ());
17041704
1705- $ application ->register ('dym ' )->setCode (function (InputInterface $ input , OutputInterface $ output ) {
1706- new \UnknownClass ( );
1705+ $ application ->register ('dym ' )->setCode (function () {
1706+ throw new \Error ( ' Something went wrong. ' );
17071707 });
17081708
17091709 $ tester = new ApplicationTester ($ application );
@@ -1712,7 +1712,7 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn
17121712 $ tester ->run (['command ' => 'dym ' ]);
17131713 $ this ->fail ('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent. ' );
17141714 } catch (\Error $ e ) {
1715- $ this ->assertSame ($ e ->getMessage (), ' Class \' UnknownClass \' not found ' );
1715+ $ this ->assertSame (' Something went wrong. ' , $ e ->getMessage ());
17161716 }
17171717 }
17181718}
0 commit comments