PHPUnit test suite include path

后端 未结 3 1789
迷失自我
迷失自我 2021-02-13 20:04

Using phpunit and I am having some trouble with include paths, not for phpunit itself, but for my code and tests directory.

I have the following code structure:

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-13 20:46

    The best place to set your PHP include path is in your bootstrap file. Usually, your phpunit.xml file will include a bootstrap attribute:

    
    

    Then in your bootstrap file you can set include paths, include important files, etc..

    set_include_path(get_include_path() . PATH_SEPARATOR . '../my/sources');
    

    The config file is covered in Appendix C of the PHPunit docs.

    EDIT: Link updated

提交回复
热议问题