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

后端 未结 5 1915
无人共我
无人共我 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:44

    The bootstrap option can be used on these cases.

    You can call it from the command line

    phpunit --bootstrap myBootstrap.php
    

    Or put it in the XML file, like this:

    
    ...
    
    

提交回复
热议问题