Integrate PHPT test cases with PHPUnit

前端 未结 2 1020
栀梦
栀梦 2020-12-16 16:15

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

2条回答
  •  眼角桃花
    2020-12-16 16:34

    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 .phpt file to the parent constructor.

    Alternatively, you can use the PHPUnit_Extensions_PhptTestSuite class, that takes a directory as its first constructor argument and then searches for all *.phpt files within this directory.

提交回复
热议问题