Sometimes you’ve got a big codebase that isn’t just Perl. Maybe you’ve got PHP mixed in with it, and you want to test the PHP along with all the Perl code, too. Perl’s *prove* program doesn’t care if the testing results it parses are from Perl, PHP or even static files, so long as they’re in the [TAP](http://testanything.org/) format. However, actually getting *prove* to run those PHP programs takes a little doing. Fortunately, Test::Harness 3.xx has hooks for source handlers.
David Wheeler has written about running PostgreSQL tests under *prove* [in his blog](http://justatheory.com/computers/programming/perl/tap-parser-sourcehandler.html) and I stole from his code shamelessly to create [TAP::Parser::SourceHandler::PHP](http://search.cpan.org/dist/TAP-Parser-SourceHandler-PHP/), released to the CPAN this morning.
So now, to run the Perl .t files and the PHP .phpt files all in one swell foop, here’s what we do at work:
prove -r -I/home/alester/proj/Lib --source=Perl --ext=.t --source=PHP --ext=.phpt --php-option=include_path=/home/alester/proj/Class --php-option=extension=.phpt
That --source=PHP tells *prove* to load up TAP::Parser::SourceHandler::PHP. The --php-option tells *prove* to pass those options through to the SourceHandler. If we had PostgreSQL tests or MySQL tests, we could use the SourceHandlers for those that David Wheeler has written as well.
Now we can test everything all in one run, and we get all the benefits of Test::Harness 3.xx, like parallel tests and TAP archiving and so on.