Is it not TDD that your testuite fails to write tests?
I assume your thought is that he is dying with a fatal error, and not just showing the red line "i failed". A very interesting point, I am doing TDD with phpunit, but it never listened to me at all.
The first thing that came to mind was --process-isolation
.
Example:
Suppose a test class looks like this:
<?php class fooTest extends PHPUnit_Framework_TestCase { public function testA() { $x = new a(); } public function testB() { $this->assertTrue(true); } }
using a regular phpunit test.php
runner:
PHPUnit 3.5.12 by Sebastian Bergmann. Fatal error: Class 'a' not found in /home/mcsvnls/mep.php on line 6
but when using the phpunit --process-isolation test.php
switch, it looks like this:
PHPUnit 3.5.12 by Sebastian Bergmann. E. Time: 1 second, Memory: 3.25Mb There was 1 error: 1) fooTest::testA RuntimeException: Fatal error: Class 'a' not found in /home/foo/mep.php on line 6 Call Stack: 0.0005 102364 1. {main}() /home/foo/-:0 0.0341 1768644 2. __phpunit_run_isolated_test() /home/foo/-:143 [...........] FAILURES! Tests: 2, Assertions: 1, Errors: 1.
And now the second test runs and passes
source share