@@ -57,9 +57,13 @@ public function setUp()
5757 public function testWritesResultsOfWhoopsExceptionsHandlingToResponse ()
5858 {
5959 $ error = new RuntimeException ();
60+ $ sendOutputFlag = true ;
6061
6162 $ this ->whoops ->getHandlers ()->willReturn ([]);
6263 $ this ->whoops ->handleException ($ error )->willReturn ('WHOOPS ' );
64+ $ this ->whoops ->writeToOutput ()->willReturn ($ sendOutputFlag );
65+ $ this ->whoops ->writeToOutput (false )->shouldBeCalled ();
66+ $ this ->whoops ->writeToOutput ($ sendOutputFlag )->shouldBeCalled ();
6367
6468 // Could do more assertions here, but these will be sufficent for
6569 // ensuring that the method for injecting metadata is never called.
@@ -83,6 +87,7 @@ public function testWritesResultsOfWhoopsExceptionsHandlingToResponse()
8387 public function testAddsRequestMetadataToWhoopsPrettyPageHandler ()
8488 {
8589 $ error = new RuntimeException ('STATUS_INTERNAL_SERVER_ERROR ' , StatusCode::STATUS_INTERNAL_SERVER_ERROR );
90+ $ sendOutputFlag = true ;
8691
8792 $ handler = $ this ->prophesize (PrettyPageHandler::class);
8893 $ handler
@@ -100,6 +105,9 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler()
100105
101106 $ this ->whoops ->getHandlers ()->willReturn ([$ handler ->reveal ()]);
102107 $ this ->whoops ->handleException ($ error )->willReturn ('WHOOPS ' );
108+ $ this ->whoops ->writeToOutput ()->willReturn ($ sendOutputFlag );
109+ $ this ->whoops ->writeToOutput (false )->shouldBeCalled ();
110+ $ this ->whoops ->writeToOutput ($ sendOutputFlag )->shouldBeCalled ();
103111
104112 $ this ->request ->getAttribute ('originalUri ' , false )->willReturn ('https://example.com/foo ' );
105113 $ this ->request ->getAttribute ('originalRequest ' , false )->will ([$ this ->request , 'reveal ' ]);
@@ -128,6 +136,7 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler()
128136 public function testJsonContentTypeResponseWithJsonResponseHandler ()
129137 {
130138 $ error = new RuntimeException ('STATUS_NOT_IMPLEMENTED ' , StatusCode::STATUS_NOT_IMPLEMENTED );
139+ $ sendOutput = true ;
131140
132141 $ handler = $ this ->prophesize (JsonResponseHandler::class);
133142
@@ -137,6 +146,9 @@ public function testJsonContentTypeResponseWithJsonResponseHandler()
137146
138147 $ this ->whoops ->getHandlers ()->willReturn ([$ handler ->reveal ()]);
139148 $ this ->whoops ->handleException ($ error )->willReturn ('error ' );
149+ $ this ->whoops ->writeToOutput ()->willReturn ($ sendOutput );
150+ $ this ->whoops ->writeToOutput (false )->shouldBeCalled ();
151+ $ this ->whoops ->writeToOutput ($ sendOutput )->shouldBeCalled ();
140152
141153 $ this ->request ->getAttribute ('originalUri ' , false )->willReturn ('https://example.com/foo ' );
142154 $ this ->request ->getAttribute ('originalRequest ' , false )->will ([$ this ->request , 'reveal ' ]);
0 commit comments