@@ -914,7 +914,7 @@ public function testRunWithDispatcher()
914914 }
915915
916916/**
917- * @expectedException \LogicException
917+ * @expectedException \RuntimeException
918918 * @expectedExceptionMessage caught
919919 */
920920public function testRunWithExceptionAndDispatcher ()
@@ -925,7 +925,7 @@ public function testRunWithExceptionAndDispatcher()
925925$ application ->setCatchExceptions (false );
926926
927927$ application ->register ('foo ' )->setCode (function (InputInterface $ input ,OutputInterface $ output ) {
928- throw new \RuntimeException ('foo ' );
928+ throw new \RuntimeException ('caught ' );
929929 });
930930
931931$ tester =new ApplicationTester ($ application );
@@ -949,37 +949,42 @@ public function testRunDispatchesAllEventsWithException()
949949$ this ->assertContains ('before.foo.caught.after. ' ,$ tester ->getDisplay ());
950950 }
951951
952- public function testRunDispatchesAllEventsWithError ()
952+ /**
953+ * @expectedException \Error
954+ * @expectedExceptionMessage caught
955+ */
956+ public function testRunWithErrorAndDispatcher ()
953957 {
954958$ application =new Application ();
955959$ application ->setDispatcher ($ this ->getDispatcher ());
956960$ application ->setAutoExit (false );
961+ $ application ->setCatchExceptions (false );
957962
958- $ application ->register ('dym ' )->setCode (function (InputInterface $ input ,OutputInterface $ output ) {
959- $ output ->write ('dym. ' );
960-
961- throw new \Error ('dymerr ' );
963+ $ application ->register ('foo ' )->setCode (function (InputInterface $ input ,OutputInterface $ output ) {
964+ throw new \Error ('caught ' );
962965 });
963966
964967$ tester =new ApplicationTester ($ application );
965- $ tester ->run (array ('command ' =>'dym ' ));
966- $ this ->assertContains ('before.dym.caught.after. ' ,$ tester ->getDisplay (),'The PHP Error did not dispached events ' );
968+ $ tester ->run (array ('command ' =>'foo ' ));
967969 }
968970
971+ /**
972+ * @expectedException \Error
973+ * @expectedExceptionMessage caught
974+ */
969975public function testRunWithErrorFailingStatusCode ()
970976 {
971977$ application =new Application ();
972978$ application ->setDispatcher ($ this ->getDispatcher ());
973979$ application ->setAutoExit (false );
980+ $ application ->setCatchExceptions (false );
974981
975- $ application ->register ('dus ' )->setCode (function (InputInterface $ input ,OutputInterface $ output ) {
976- $ output ->write ('dus. ' );
977-
978- throw new \Error ('duserr ' );
982+ $ application ->register ('foo ' )->setCode (function (InputInterface $ input ,OutputInterface $ output ) {
983+ throw new \Error ('caught ' );
979984 });
980985
981986$ tester =new ApplicationTester ($ application );
982- $ tester ->run (array ('command ' =>'dus ' ));
987+ $ tester ->run (array ('command ' =>'foo ' ));
983988$ this ->assertSame (1 ,$ tester ->getStatusCode (),'Status code should be 1 ' );
984989 }
985990