tags:

views:

50

answers:

1

When an error that the PHPunit framework does not expect to occur happens, the testing stops, and PHP throws the error, but PHPunit does not record that it was an error. How do I make sure PHPunit records it as an error.

A: 

Disclaimer, I'm new to PHPUnit and am trying to figure out the whole 'what happens when an error occurs' too.

From PHPUnit's docs:

When the tested code contains PHP syntax errors, the TextUI test runner might exit without printing error information. The standard test suite loader can optionally check the test suite sourcefile for PHP syntax errors, but not sourcefiles included by the test suite sourcefile.

And the option:

--syntax-check           Try to check source files for syntax errors.
Tim Lytle
See my last comment to the original question. (It is hidden by default.) There does not seem to be a PHP syntax error; merely an SQL syntax error.
janmoesen
@janmoesen I know, but in the comments the OP also says, "So lets say there is a syntax error in the code. An extra comma or missing semi-colon. This will cause a certain test not to be able to run, and the testing will cease, but PHPunit does not report it as an error, and php will output the error, but there is no logging of this by PHPunit."
Tim Lytle