PHPUnit: How do I create a function to be called once for all the tests in a class?

后端 未结 5 2015
无人共我
无人共我 2021-02-02 04:58

I have a PHPUnit test case class (consisting of some test functions). I would like to write a oneTimeSetUp() function to be called once for all my tests in the clas

5条回答
  •  醉酒成梦
    2021-02-02 05:31

    Take a look at setUpBeforeClass() from section 6 of the PHPUnit documentation.

    For the one time tearDown you should use tearDownAfterClass();.

    Both this methods should be defined in your class as static methods.

提交回复
热议问题