Skip to main content
10 events
when toggle format what by license comment
Jan 22, 2015 at 19:53 comment added hek2mgl Let us continue this discussion in chat.
Jan 22, 2015 at 19:32 comment added hek2mgl If you like so, let's create a fork! (... and discuss details there). Thinking the idea is good and it will not require too much changes (and work to do).
Jan 22, 2015 at 19:28 comment added aercolino The isolation template is customizable by default. -- The rest is difficult to do from userland. We'd put a class in the middle of PHPUnit_Util_PHP and its descendants (..._Default and ..._Windows) to override runTestJob as outlined above. Then, from the test case class, we'd override run so that here we can instantiate our middle class.
Jan 22, 2015 at 17:28 comment added hek2mgl Nice research! Unfortunately the file name of the template is hardcoded in the source code. Also the @expectedShutdownError would need to get implemented. We would need to fork PHPUnit in order to make the change happen (or am I missing something?)
Jan 22, 2015 at 17:08 comment added aercolino I've found there is a customizable isolation template. There we need to register_shutdown_function('__phpunit_shutdown', $test, $result). __phpunit_shutdown($test, $result) (in case of error) only prints a serialized array like usual, but with an added error key set to error_get_last(). Then we can add support for an @expectedShutdownError <code> from PHPUnit_Util_PHP::runTestJob, which would call processChildResult with doctored arguments (mainly stderr = '').
Jan 22, 2015 at 11:09 comment added hek2mgl Now I got your concerns. Will play around with PHPUnit a little bit, probably write some code and give you a feedback..
Jan 20, 2015 at 23:44 comment added aercolino Well, it "works" in the console because I see the fatal error. The $return is always 255 for the six uncatchable errors and always 0 otherwise. I think I need a shutdown handler to get to the error code. -- as for PHPUnit, even if I @runInSeparateProcess a single test causing a fatal error, it always appears as an 'E'. -- Your idea is interesting, and I upped you before. But to make it work, I think I need to dig into PHPUnit and write a patch or plugin. I wonder why nobody did it before. Is it unreasonable to expect a script to fail?
Jan 15, 2015 at 21:12 comment added hek2mgl Can you prove that? I don't think so
Jan 15, 2015 at 19:17 comment added aercolino In practice, this only works for detecting syntax errors, because (1) a script does not usually survive isolated, (2) it's unfeasible to bootstrap an entire application like this, (3) it does not create a testing/repeatable context, (4) not having all the context set up could cause false fatal errors like undefined function. Thus, instead of executing php $tempfile it's better to execute php --no-php-ini --syntax-check $tempfile. php.net/manual/en/features.commandline.options.php
Dec 20, 2012 at 22:28 history answered hek2mgl CC BY-SA 3.0