@@ -165,5 +165,79 @@ public function testThat___invoke_WorksAsExpected() {
165165 sprintf ("Trace: %s {$ nl }" , $ exception_with_previous_exception ->getPrevious ()->getTraceAsString ()),
166166 $ result4
167167 );
168+
169+ // Set a container on the renderer with both AppSettingsKeys::LOG_ERRORS
170+ // and AppSettingsKeys::LOG_ERROR_DETAILS set to true and
171+ // AppSettingsKeys::DISPLAY_ERROR_DETAILS set to false
172+ $ container = $ this ->getContainer ([
173+ \SlimMvcTools \AppSettingsKeys::LOG_ERRORS => true ,
174+ \SlimMvcTools \AppSettingsKeys::LOG_ERROR_DETAILS => true ,
175+ \SlimMvcTools \AppSettingsKeys::DISPLAY_ERROR_DETAILS => false ,
176+ ]);
177+
178+ $ display_error_details = false ;
179+ $ log_error_renderer ->setContainer ($ container );
180+ $ result5 = $ log_error_renderer ($ exception_with_previous_exception , $ display_error_details );
181+ self ::assertStringContainsString (
182+ "APP Error {$ nl }" ,
183+ $ result5
184+ );
185+ self ::assertStringNotContainsString (
186+ 'Request Uri: ' ,
187+ $ result5
188+ );
189+ self ::assertStringContainsString (
190+ sprintf ("Type: %s {$ nl }" , get_class ($ exception_with_previous_exception )),
191+ $ result5
192+ );
193+ self ::assertStringContainsString (
194+ sprintf ("Code: %s {$ nl }" , $ exception_with_previous_exception ->getCode ()),
195+ $ result5
196+ );
197+ self ::assertStringContainsString (
198+ sprintf ("Message: %s {$ nl }" , htmlentities ($ exception_with_previous_exception ->getMessage ())),
199+ $ result5
200+ );
201+ self ::assertStringContainsString (
202+ sprintf ("File: %s {$ nl }" , $ exception_with_previous_exception ->getFile ()),
203+ $ result5
204+ );
205+ self ::assertStringContainsString (
206+ sprintf ("Line: %s {$ nl }" , $ exception_with_previous_exception ->getLine ()),
207+ $ result5
208+ );
209+ self ::assertStringContainsStringIgnoringCase (
210+ sprintf ("Trace: %s {$ nl }" , $ exception_with_previous_exception ->getTraceAsString ()),
211+ $ result5
212+ );
213+ self ::assertStringContainsString (
214+ "Previous Error: " ,
215+ $ result5
216+ );
217+
218+ self ::assertStringContainsString (
219+ sprintf ("Type: %s {$ nl }" , get_class ($ exception_with_previous_exception ->getPrevious ())),
220+ $ result5
221+ );
222+ self ::assertStringContainsString (
223+ sprintf ("Code: %s {$ nl }" , $ exception_with_previous_exception ->getPrevious ()->getCode ()),
224+ $ result5
225+ );
226+ self ::assertStringContainsString (
227+ sprintf ("Message: %s {$ nl }" , htmlentities ($ exception_with_previous_exception ->getPrevious ()->getMessage ())),
228+ $ result5
229+ );
230+ self ::assertStringContainsString (
231+ sprintf ("File: %s {$ nl }" , $ exception_with_previous_exception ->getPrevious ()->getFile ()),
232+ $ result5
233+ );
234+ self ::assertStringContainsString (
235+ sprintf ("Line: %s {$ nl }" , $ exception_with_previous_exception ->getPrevious ()->getLine ()),
236+ $ result5
237+ );
238+ self ::assertStringContainsStringIgnoringCase (
239+ sprintf ("Trace: %s {$ nl }" , $ exception_with_previous_exception ->getPrevious ()->getTraceAsString ()),
240+ $ result5
241+ );
168242 }
169243}
0 commit comments