简体   繁体   English

您如何将PHPUnit与VSCode一起使用?

[英]How do you use PHPUnit with VSCode?

I've done some PHPUnit tests with Netbeans, but couldn't get the latest version (PHPUnit 8) to work. 我已经使用Netbeans完成了一些PHPUnit测试,但是无法使最新版本(PHPUnit 8)正常工作。 So I'd like to try it in VSCode. 所以我想在VSCode中尝试一下。

Any suggestions or links to tutorials on getting them to work together? 关于如何使它们协同工作的任何建议或链接?

You need to define a custom task in the tasks.json file that should be located in the .vscode directory. 您需要在tasks.json文件中定义一个自定义任务,该文件应该位于.vscode目录中。 The custom task can be something like this: 自定义任务可以是这样的:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Run tests",
            "type": "shell",
            "command": "phpunit",
            "args": ["--stop-on-error"],
            "group": "test",
            "presentation": {
                "reveal": "always",
                "panel": "new"
            }
        }
    ]
}

Read more about it in the documentation: https://code.visualstudio.com/docs/editor/tasks#_custom-tasks 在文档中阅读有关它的更多信息: https : //code.visualstudio.com/docs/editor/tasks#_custom-tasks

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM