@@ -55,9 +55,13 @@ public function setUp()
55
55
public function testWritesResultsOfWhoopsExceptionsHandlingToResponse ()
56
56
{
57
57
$ error = new RuntimeException ();
58
+ $ sendOutput = true ;
58
59
59
60
$ this ->whoops ->getHandlers ()->willReturn ([]);
60
61
$ this ->whoops ->handleException ($ error )->willReturn ('WHOOPS ' );
62
+ $ this ->whoops ->writeToOutput ()->willReturn ($ sendOutput );
63
+ $ this ->whoops ->writeToOutput (false )->shouldBeCalled ();
64
+ $ this ->whoops ->writeToOutput ($ sendOutput )->shouldBeCalled ();
61
65
62
66
// Could do more assertions here, but these will be sufficent for
63
67
// ensuring that the method for injecting metadata is never called.
@@ -81,6 +85,7 @@ public function testWritesResultsOfWhoopsExceptionsHandlingToResponse()
81
85
public function testAddsRequestMetadataToWhoopsPrettyPageHandler ()
82
86
{
83
87
$ error = new RuntimeException ('STATUS_INTERNAL_SERVER_ERROR ' , StatusCode::STATUS_INTERNAL_SERVER_ERROR );
88
+ $ sendOutput = true ;
84
89
85
90
$ handler = $ this ->prophesize (PrettyPageHandler::class);
86
91
$ handler
@@ -98,6 +103,9 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler()
98
103
99
104
$ this ->whoops ->getHandlers ()->willReturn ([$ handler ->reveal ()]);
100
105
$ this ->whoops ->handleException ($ error )->willReturn ('WHOOPS ' );
106
+ $ this ->whoops ->writeToOutput ()->willReturn ($ sendOutput );
107
+ $ this ->whoops ->writeToOutput (false )->shouldBeCalled ();
108
+ $ this ->whoops ->writeToOutput ($ sendOutput )->shouldBeCalled ();
101
109
102
110
$ this ->request ->getAttribute ('originalUri ' , false )->willReturn ('https://example.com/foo ' );
103
111
$ this ->request ->getAttribute ('originalRequest ' , false )->will ([$ this ->request , 'reveal ' ]);
@@ -126,6 +134,7 @@ public function testAddsRequestMetadataToWhoopsPrettyPageHandler()
126
134
public function testJsonContentTypeResponseWithJsonResponseHandler ()
127
135
{
128
136
$ error = new RuntimeException ('STATUS_NOT_IMPLEMENTED ' , StatusCode::STATUS_NOT_IMPLEMENTED );
137
+ $ sendOutput = true ;
129
138
130
139
$ handler = $ this ->prophesize (JsonResponseHandler::class);
131
140
@@ -135,6 +144,9 @@ public function testJsonContentTypeResponseWithJsonResponseHandler()
135
144
136
145
$ this ->whoops ->getHandlers ()->willReturn ([$ handler ->reveal ()]);
137
146
$ this ->whoops ->handleException ($ error )->willReturn ('error ' );
147
+ $ this ->whoops ->writeToOutput ()->willReturn ($ sendOutput );
148
+ $ this ->whoops ->writeToOutput (false )->shouldBeCalled ();
149
+ $ this ->whoops ->writeToOutput ($ sendOutput )->shouldBeCalled ();
138
150
139
151
$ this ->request ->getAttribute ('originalUri ' , false )->willReturn ('https://example.com/foo ' );
140
152
$ this ->request ->getAttribute ('originalRequest ' , false )->will ([$ this ->request , 'reveal ' ]);
0 commit comments