转自http://blog.csdn.net/zhuziying99/article/details/49028321

phpstorm集成phpunit
1.下载phpunit.phar,将该文件放到某个工程中
2.File > Settings > Languages & Frameworks > PHP > PHPUnit
Path to phpunit.phar:选择该工程下的phpunit.phar文件
3.新建文件夹src放源文件,tests放测试文件,在src中新建autoload.php
<?php
function  __autoload($className)
{
    $filePath = "src/{$className}.php";
    if (is_readable($filePath)) {
        require($filePath);
    }
}
4.要生成某个类的测试用例,点类名右键 > Go To > Test > Create New Test ,测试类的路径选择tests
5.新建phpunit运行配置,Test Runner options添 --bootstrap src/autoload.php
6.运行phpunit,如果提示interpreter is not specified,查看File > Settings > Languages & Frameworks > PHP 解释器是否设置

相关文章:

  • 2021-12-07
  • 2021-05-16
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-21
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2022-02-08
相关资源
相似解决方案