PHPStorm 8 + PHPUnit 4.2.6错误 [英] PHPStorm 8 + PHPUnit 4.2.6 Error

查看:72
本文介绍了PHPStorm 8 + PHPUnit 4.2.6错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使 PHPUnit 4.2.6 PHPStorm 8 一起使用.

PHPUnit被作为phar加载到PHPStorm 8设置中.

PHPUnit is loaded as phar inside PHPStorm 8 settings.

每当我尝试在PHPStorm中运行单元测试时,都会出现此错误:

Whenever i try to run unit test in PHPStorm i get this error:

Parse error: syntax error, unexpected '}' in /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php(171) : eval()'d code on line 1

Call Stack:
0.0006     344584   1. {main}() /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php:0
0.0007     344880   2. IDE_PHPUnit_Loader::init() /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php:194


Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php on line 49

当我查看"ide-phpunit.php"时,我发现由于"substr"功能用法无效,它试图评估无效代码.

When i looked into "ide-phpunit.php", i found that it tries to eval invalid code, because of invalid "substr" function usage.

所以我的问题是,是否有人设法使PHPUnit 4.2.6与PHPStorm 8一起使用?

So my question is, if someone managed to make PHPUnit 4.2.6 work with PHPStorm 8?

推荐答案

PhpStorm会生成特殊的临时包装",以执行测试并以更好理解的形式获取输出.您的情况是/private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php.由于错误表明存在语法错误,因此您应该首先尝试将其删除,IDE在下一次运行时将创建新的,希望不会出现此问题.

PhpStorm generates special temporary "wrapping" to execute the tests and get the output in the form it understands better. In your case it's /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php. Since the error says there is a syntax error, the first thing you should try is deleting it, on the next run the IDE will create the new one, hopefully without that problem.

如果这没有帮助,如注释中所建议,请尝试将PHPUnit降级几个版本,看看是否有帮助.或者尝试重新安装PhpStorm.如果这样不起作用,则您可以通过向问题报告来找到答案的机会更大开发团队.

If that doesn't help, as suggested in the comments, try downgrading the PHPUnit a few versions back, see if that helps. Alternatively try reinstalling the PhpStorm. If that doesn't work, you have better chances of finding an answer by reporting an issue to the dev team.

这篇关于PHPStorm 8 + PHPUnit 4.2.6错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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