tags:

views:

7

answers:

1

Below is my phpunit.xml file. All methods of logging stop as soon as a PHP fatal error is achieved. I want to be able to have a log of this error.

<phpunit verbose="true" colors="true" stopOnFailure="false" syntaxCheck="true">
    <logging>
    <log type="tap" target="results/results.tap"/>
    <log type="testdox-text" target="results/results.txt" />
        <log type="junit" target="results/results.junit" logIncompleteSkipped="true"/>
        <log type="json" target="results/results.js"/>
        <log type="coverage-html" target="results/report" charset="UTF-8"
           yui="false" highlight="false"
           lowUpperBound="35" highLowerBound="70"/>
    </logging>
</phpunit>
A: 

Since phpunit (or rather your tests) run in a fatal error the php interpreter isn't able to do much more than die so logging via phpunit seems rather hard.

Maybe running each test as seperate process ( Using the --process-isolation switch or setting processIsolation="true" ) might help you a little bit. But that slows down your Testsuite and so on.

So as a quick solution you could put the error output of php into a logfile (in case display_errors is on).

phpunit yourTests 2> errors.log

Maybe use a different php.ini for your testruns and provide a logfile there or just pass it to php via

echo "" > error.log && phpunit -d error_log=error.log yourTests

so you at least have a file with the errors to check against.

edorian