I have a suite of PHPUnit tests for my extension, and I want to run them as part of the extension's Hudson build process.
So I want to run PHPUnit specifying the extension library to load at runtime, but I can't figure out how to do this.
My directory structure is as follows:
/myextension.c
/otherextensionfiles.*
/modules/myextension.so
/tests/unittests.php
I've tried running PHPUnit with an configuration XML file as follows:
<phpunit>
<php>
<ini name="extension_dir" value="../modules/"/>
<ini name="extension" value="myextension.so"/>
</php>
</phpunit>
And then running it as follows (from the tests
directory):
phpunit --configuration config.xml unittests.php
But then I get Fatal error: Call to undefined function myfunction()
, so it's not loading the library.
I've also tried:
phpunit -d extension_dir=../modules/ -d extension=myextension.so unittests.php
And also dl('myextension.so')
to the test setup, but no joy.
If it's relevant, this is using PHP 5.2 and PHPUnit 3.4.11.
I've cross-posted this question on the PHPUnit users mailing list.