How can I get PHPUnit to run my PHPT test cases and integrate the pass/fail status into the overall metrics? I am already aware of how to run these tests using run-phpt from the command line, but I want to run them from within PHPUnit with my other tests.
I’m aware that the PHPUnit_Extensions_PhptTestCase exists but I couldn’t find any samples on how to use it.
While the main point of this blog post about testing file uploads is to describe how to write PHPT tests, it shows how to integrate them into PHPUnit at the end of the post. In short, you pass the absolute path to the
.phptfile to the parent constructor.Alternatively, you can use the
PHPUnit_Extensions_PhptTestSuiteclass, that takes a directory as its first constructor argument and then searches for all *.phpt files within this directory.