我有一套用于我的扩展的 PHPUnit 测试,我想将它们作为扩展的 Hudson 构建过程的一部分运行。
所以我想运行 PHPUnit 指定要在运行时加载的扩展库,但我不知道如何做到这一点。
我的目录结构如下:
/myextension.c
/otherextensionfiles.*
/modules/myextension.so
/tests/unittests.php
我尝试使用配置 XML文件运行 PHPUnit,如下所示:
<phpunit>
<php>
<ini name="extension_dir" value="../modules/"/>
<ini name="extension" value="myextension.so"/>
</php>
</phpunit>
然后按如下方式运行它(从tests
目录):
phpunit --configuration config.xml unittests.php
但后来我得到Fatal error: Call to undefined function myfunction()
了,所以它没有加载库。
我也试过:
phpunit -d extension_dir=../modules/ -d extension=myextension.so unittests.php
还有dl('myextension.so')
测试设置,但没有乐趣。
如果相关,这是使用 PHP 5.2 和 PHPUnit 3.4.11。
我已经在 PHPUnit users mailing list 上交叉发布了这个问题。