沃梦达 / 编程问答 / php问题 / 正文

PHPUnit 通过 Composer 和 PhpStorm

PHPUnit via Composer and PhpStorm(PHPUnit 通过 Composer 和 PhpStorm)

本文介绍了PHPUnit 通过 Composer 和 PhpStorm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在尝试了几个小时来设置 PhpStorm 进行单元测试.无论我做什么,我都会得到这个

I'm now trying for hours to setup PhpStorm for unit testing. Whatever I do, I get this

Process finished with exit code 1
Cannot find PHPUnit in include path ...

PHPUnit 可以(通过命令行)从任何地方访问;我已经设置了正确的包含路径并将 PHPUnit 添加到外部库中.没有机会.

PHPUnit is (via command line) accessible from anywhere; I've set the correct include path and have added PHPUnit to the external libraries. No chance.

有没有可能,还是只能通过 PEAR 进行安装?我在这里解决了所有相关问题,我在 Mac 上,PHPUnit 通过 CLI 顺利运行.

Is it possible at all or does it only work with installations via PEAR? I've worked through all related questions here, am on Mac and PHPUnit is running smoothly via CLI.

推荐答案

Patrick Visma 在 上发布了解决方案http://youtrack.jetbrains.com/issue/WI-13429:

Patrick Visma posted the solution on http://youtrack.jetbrains.com/issue/WI-13429:

在 PHPStorm 中编辑 phpunit.xml 的配置,并像这样设置解释器选项:

Edit the configuration for your phpunit.xml in PHPStorm, and set the Interpreter options like this:

-d auto_prepend_file=/path/to/vendor/autoload.php

这篇关于PHPUnit 通过 Composer 和 PhpStorm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:PHPUnit 通过 Composer 和 PhpStorm

基础教程推荐