mercredi 24 janvier 2018

PHP Warning throws ErrorException

A unit test is failing because an ErrorException about an undefined property is thrown. However, this happens in a connected shop system's core files which i cannot change.

My controller has a try ... catch block that catches the generic Exception object. But i don't want that catch to fire because of an undefined property.

I figured out the error is converted to an ErrorException in HandleExceptions.php in method handleError

How can i make phpunit ignore notices and warnings coming from code pieces i can't touch?

What i've already tried

In phpunit.xml

     convertErrorsToExceptions="false"
     convertNoticesToExceptions="false"
     convertWarningsToExceptions="false"

Set APP_DEBUG=false as well as API_DEBUG=false for dingo.

I am using Dingo 1.0.x with Laravel 5.4 and phpunit 5.7.26.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire