如何在Ubuntu 13.10上为Intellij IDEA 13.1设置PHPUnit? [英] How to setup PHPUnit for Intellij IDEA 13.1 on Ubuntu 13.10?

查看:331
本文介绍了如何在Ubuntu 13.10上为Intellij IDEA 13.1设置PHPUnit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IDEA 13.1开发PHP5程序.当然,我想使用一些单元测试来介绍我的代码. 我通过aptitude安装了phpunit,并使用pear将其升级到4.0.11.

I'm developing a PHP5 program using IDEA 13.1. Of course I want to cover my code using some Unit tests. I installed phpunit via aptitude and upgraded it to 4.0.11 using pear.

以某种方式,IDEA似乎无法检测到已安装的PHPUnit ...类PHPUnit_Framework_TestCase被标记为未定义. https://www.jetbrains.com/idea/webhelp/上的文档enabled-phpunit-support.html 希望我包括pear目录(不存在)或phpunit.phar(也不存在).

Somehow IDEA seems unable to detect the installed PHPUnit... The class PHPUnit_Framework_TestCase is marked as undefined. The documentation on https://www.jetbrains.com/idea/webhelp/enabling-phpunit-support.html wants me to include either the pear directory (which does not exist) or the phpunit.phar (which does not exist, either).

到目前为止,使用IDEA进行的大多数操作都很顺利,所以令我感到惊讶的是,设置PHPUnit等基本功能不起作用:-(

So far most things went smooth with IDEA so I'm surprised that something as fundamental as setting up PHPUnit does not work :-(

推荐答案

好吧,经过一些摆弄之后,我得到了一个可行的解决方案.我从phpunit.de下载了phpunit-lts.phar并将其直接放入项目中(连同其他文件... meh).

Ok, after some fiddling around I got to a working solution. I downloaded phpunit-lts.phar from phpunit.de and put it directly into the project (along with the other files... meh).

请勿使用PHPUnit的最新版本(2014年3月21日为4.0)! IDEA或PHPStorm不支持​​3.7(或3.8)以上的版本.你会得到

Do not use the most current version (4.0 as of 21st of march 2014) of PHPUnit! Versions beyond 3.7 (or 3.8, as it seems) are not supported by IDEA or PHPStorm. You will get

PHP Fatal error:  Class IDE_PHPUnit_Framework_TestListener contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest) in /tmp/ide-phpunit.php on line 504

帮自己一个忙,暂时坚持使用LTS版本.

So do yourself a favor and stick to the LTS version for now.

这篇关于如何在Ubuntu 13.10上为Intellij IDEA 13.1设置PHPUnit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆