使用HHVM(HipHop)运行phpunit测试 [英] Running phpunit tests using HHVM (HipHop)
问题描述
我正在尝试在虚拟Ubuntu 12.04(64位服务器)安装上通过HHVM运行PHPUnit单元测试.这些测试通常使用位于我的tests目录中的phpunit.xml文件运行,该文件包含一个用于处理自动加载的引导文件,并且这些测试在普通的php安装中运行良好.但是,我不断得到:
I am trying to run PHPUnit unit tests via HHVM on a virtual Ubuntu 12.04 (64-bit Server) install. The tests usually run using a phpunit.xml file located in my tests directory, which includes a bootstrap file to handle autoloading, and the tests run fine on an ordinary php install. However, I keep getting:
HipHop Fatal error: File not found: File/Iterator/Autoload.php in /usr/share/php/PHPUnit/Autoload.php on line 64
运行时:
hhvm -f /usr/bin/phpunit /path/to/my/testsDirectory/SomeTest.php
而且我还无法弄清楚如何使用引导程序或配置文件在hhvm下运行phpunit ...任何帮助.
And I haven't been able to figure out how to run phpunit under hhvm using a bootstrap or config file... Any help would be appreciated.
推荐答案
HHVM 2.4 +
HHVM 2.4.0仅发布了 ,它具有完整的phpunit支持!只需给出phpunit二进制文件的完整路径,就像这样:
HHVM 2.4+
HHVM 2.4.0 was just released and it came with full phpunit support! Just give the full path to phpunit binary, like this:
$ hhvm /usr/bin/phpunit
干杯!
从HHVM wiki 测试了此分步指南一个>,它的工作原理.这是一个简化的指南:
Tested this step by step guide from HHVM wiki and it works. Here is a simplified guide:
在您的项目上,将以下条目添加到composer.json文件中:
On your project, add the following entries to your composer.json file:
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/php-invoker": "1.1.3",
"phpunit/dbunit": "1.2.3",
"phpunit/phpunit-selenium": "1.3.2",
"phpunit/phpunit-story": "1.0.2"
}
-
运行
hhvm composer.phar install --dev
.如果您在作曲家系统范围内进行安装,请运行hhvm /usr/local/bin/composer install --dev
,它也可以工作.
Run
hhvm composer.phar install --dev
. If you did a composer system wide install, runhhvm /usr/local/bin/composer install --dev
, it works too.
将创建一个供应商目录. phpunit"binary"将位于vendor/bin/phpunit
A vendor directory will be created. The phpunit "binary" will be located at vendor/bin/phpunit
要为您的项目运行PHPUnit:hhvm vendor/bin/phpunit [optional arguments]
To run PHPUnit for your project: hhvm vendor/bin/phpunit [optional arguments]
注意:也许在不太遥远的将来
hhvm /usr/local/bin/phpunit [optional arguments]
会按预期工作,但是现在这是 我们拥有的最简单的选择
Note: Probably in a not so distant future
hhvm /usr/local/bin/phpunit [optional arguments]
will work as expected, but right now this is the easiest option we have
这篇关于使用HHVM(HipHop)运行phpunit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!