|
270 | 270 |
|
271 | 271 | }); |
272 | 272 |
|
273 | | - describe('->phpError()', function () { |
274 | | - |
275 | | - it('set error_reporting & ini_set(display_errors) when display_errors config = 0', function () { |
276 | | - |
277 | | - expect('error_reporting')->toBeCalled(); |
278 | | - expect('ini_set')->toBeCalled(); |
279 | | - |
280 | | - $mvcEvent = Double::instance(['extends' => MvcEvent::class, 'methods' => '__construct']); |
281 | | - $this->listener->phpError($mvcEvent); |
282 | | - |
283 | | - }); |
284 | | - |
285 | | - it('not set error_reporting & ini_set(display_errors) when display_errors config = 0', function () { |
286 | | - |
287 | | - $config = [ |
288 | | - 'enable' => true, |
289 | | - 'display-settings' => [ |
290 | | - |
291 | | - // excluded php errors |
292 | | - 'exclude-php-errors' => [ |
293 | | - E_USER_DEPRECATED |
294 | | - ], |
295 | | - |
296 | | - // show or not error |
297 | | - 'display_errors' => 1, |
298 | | - |
299 | | - // if enable and display_errors = 0, the page will bring layout and view |
300 | | - 'template' => [ |
301 | | - 'layout' => 'layout/layout', |
302 | | - 'view' => 'error-hero-module/error-default' |
303 | | - ], |
304 | | - |
305 | | - // if enable and display_errors = 0, the console will bring message |
306 | | - 'console' => [ |
307 | | - 'message' => 'We have encountered a problem and we can not fulfill your request. An error report has been generated and send to the support team and someone will attend to this problem urgently. Please try again later. Thank you for your patience.', |
308 | | - ], |
309 | | - |
310 | | - ], |
311 | | - 'logging-settings' => [ |
312 | | - 'same-error-log-time-range' => 86400, |
313 | | - ], |
314 | | - 'email-notification-settings' => [ |
315 | | - // set to true to activate email notification on log error |
316 | | - 'enable' => false, |
317 | | - |
318 | | - // Zend\Mail\Message instance registered at service manager |
319 | | - 'mail-message' => 'YourMailMessageService', |
320 | | - |
321 | | - // Zend\Mail\Transport\TransportInterface instance registered at service manager |
322 | | - 'mail-transport' => 'YourMailTransportService', |
323 | | - |
324 | | - // email sender |
325 | | - 'email-from' => 'Sender Name <sender@host.com>', |
326 | | - |
327 | | - 'email-to-send' => [ |
328 | | - 'developer1@foo.com', |
329 | | - 'developer2@foo.com', |
330 | | - ], |
331 | | - ], |
332 | | - ]; |
333 | | - |
334 | | - $logging = Double::instance([ |
335 | | - 'extends' => Logging::class, |
336 | | - 'methods' => '__construct' |
337 | | - ]); |
338 | | - |
339 | | - $renderer = Double::instance(['extends' => PhpRenderer::class, 'methods' => '__construct']); |
340 | | - |
341 | | - $listener = new Mvc( |
342 | | - $config, |
343 | | - $logging, |
344 | | - $renderer |
345 | | - ); |
346 | | - |
347 | | - expect('error_reporting')->not->toBeCalled(); |
348 | | - expect('ini_set')->not->toBeCalled(); |
349 | | - |
350 | | - $mvcEvent = Double::instance(['extends' => MvcEvent::class, 'methods' => '__construct']); |
351 | | - $listener->phpError($mvcEvent); |
352 | | - |
353 | | - }); |
354 | | - |
355 | | - }); |
356 | | - |
357 | 273 | describe('->execOnShutdown()', function () { |
358 | 274 |
|
359 | 275 | it('call error_get_last() and return nothing', function () { |
|
0 commit comments