Why does phpunit not show any errors in the console

前端 未结 3 1102
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 01:44

I\'m using phpunit with Laravel 4 framework. Why is it that when there\'s a PHP error during the tests, no error messages are shown (eg: missing method)?

How can we

3条回答
  •  没有蜡笔的小新
    2020-12-29 02:11

    This is a very common issue, especially when you are running tests on a production server or when the tester isn't very aware of the PHP configuration.

    The issue is related to php.ini settings, as pointed by Alexander Yancharuk in his answer and all the solutions he suggests work fine.

    But there is another solution that may be useful, as it was for me, which is to set the appropriate PHP settings in the PHPUnit configuration file (XML) itself, as follows:

    
        
            ...
        
        
            
            
        
    
    

    Using this you can personalize not only error display, but a lot of PHP configuration, specifically for your test suite, leaving your production configuration untouched and without having to write a bootstrap file only for this.

提交回复
热议问题