2017-04-03 14:54
浏览 22

PHPUnit 4 - TestCase子类自动加载

I need to add some assertions and some default before/after methods to all my testcases.

According to the phpunit docs I should subclass PHPUnit_Framework_TestCase but when I do this I end up having to write a bootstrap file for phpunit.

Does PHPUnit autoloading allow me to simply drop it in my tests folder with a specific filename or is it really required to make a bootstrap file?

图片转代码服务由CSDN问答提供 功能建议


根据 phpunit docs ,我应该继承< 代码> PHPUnit_Framework_TestCase 但是当我这样做时,我最终必须为phpunit编写一个bootstrap文件。

PHPUnit自动加载是否允许我简单地将它放在我的tests文件夹中 特定的文件名或是否真的需要制作引导程序文件?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doukong9982 2017-04-06 19:02

    You should use autoload-dev in composer for autoloading custom classes. PHPUnit 4 as installed through composer doesn't support running outside of composer

    打赏 评论

相关推荐 更多相似问题