I have a lot of legacy code which doesn't have unit tests. For the most part they are stand-alone scripts with autoloaded classes, run by executing each individual .php file directly.
I would like to have some method to automate the running of these scripts, checking that they run to completion without errors. This would not only detect faulty new code, but automagically find which scripts are running with errors (without trying to parse the error logs).
I saw php_check_syntax
but it is deprecated. It seems preferable to php -l
because it doesn't just lint - it executes the scripts, and would seem to capture the run-time errors to a variable which can then be read. And this seems exactly like what I'd like to do.
Is there a replacement for the php_check_syntax
which will help me accomplish this?
Perhaps creating a wrapper that uses try
and catch
(and finally
) blocks would work.